Comments
Patch
@@ -4,9 +4,9 @@
Helper extension to intercept renames.
$ cat > $TESTTMP/intercept_rename.py << EOF
- > from mercurial.extensions import wrapfunction
- > from mercurial.util import atomictempfile
- > import os, sys
+ > import os
+ > import sys
+ > from mercurial import extensions, util
>
> def extsetup(ui):
> def close(orig, *args, **kwargs):
@@ -14,7 +14,7 @@
> if path.endswith(b'/.hg/store/data/file.i'):
> os._exit(80)
> return orig(*args, **kwargs)
- > wrapfunction(atomictempfile, 'close', close)
+ > extensions.wrapfunction(util.atomictempfile, 'close', close)
> EOF
@@ -62,6 +62,28 @@
data/file.d 0
data/file.d 1046
data/file.i 128
+ $ hg recover
+ rolling back interrupted transaction
+ (verify step skipped, run `hg verify` to check your repository content)
+ $ f -s .hg/store/data/file*
+ .hg/store/data/file.d: size=1046
+ .hg/store/data/file.i: size=128
+ $ hg tip
+ changeset: 1:3ce491143aec
+ tag: tip
+ user: test
+ date: Thu Jan 01 00:00:00 1970 +0000
+ summary: _
+
+ $ hg verify
+ checking changesets
+ checking manifests
+ crosschecking files in changesets and manifests
+ checking files
+ warning: revlog 'data/file.d' not in fncache!
+ checked 2 changesets with 2 changes to 1 files
+ 1 warnings encountered!
+ hint: run "hg debugrebuildfncache" to recover from corrupt fncache
$ cd ..
Now retry the same but intercept the rename of the index and check that
@@ -83,4 +105,24 @@
data/file.i 1174
data/file.d 0
data/file.d 1046
+
+ $ hg recover
+ rolling back interrupted transaction
+ (verify step skipped, run `hg verify` to check your repository content)
+ $ f -s .hg/store/data/file*
+ .hg/store/data/file.d: size=1046
+ .hg/store/data/file.i: size=1174
+ $ hg tip
+ changeset: 1:3ce491143aec
+ tag: tip
+ user: test
+ date: Thu Jan 01 00:00:00 1970 +0000
+ summary: _
+
+ $ hg verify
+ checking changesets
+ checking manifests
+ crosschecking files in changesets and manifests
+ checking files
+ checked 2 changesets with 2 changes to 1 files
$ cd ..
@@ -56,7 +56,7 @@
unlink=True,
checkambigfiles=None,
):
- for f, o in entries:
+ for f, o in sorted(dict(entries).items()):
if o or not unlink:
checkambig = checkambigfiles and (f, b'') in checkambigfiles
try: