##// END OF EJS Templates
bundles: do not overwrite existing backup bundles (BC)...
bundles: do not overwrite existing backup bundles (BC) Previously, a backup bundle could overwrite an existing bundle and cause user data loss. For instance, if you have A<-B<-C and strip B, it produces backup bundle B-backup.hg. If you then hg pull -r B B-backup.hg and strip it again, it overwrites the existing B-backup.hg and C is lost. The fix is to add a hash of all the nodes inside that bundle to the filename. Fixed up existing tests and added a new test in test-strip.t

File last commit:

r23786:7d63398f default
r23835:aa4a1672 default
Show More
test-fncache.t
285 lines | 8.4 KiB | text/troff | Tads3Lexer
Adrian Buehlmann
tests: unify test-fncache
r11865 Init repo1:
$ hg init repo1
$ cd repo1
$ echo "some text" > a
$ hg add
adding a
$ hg ci -m first
Adrian Buehlmann
tests: sort fncache
r13389 $ cat .hg/store/fncache | sort
Adrian Buehlmann
tests: unify test-fncache
r11865 data/a.i
Testing a.i/b:
$ mkdir a.i
$ echo "some other text" > a.i/b
$ hg add
Mads Kiilerich
tests: make (glob) on windows accept \ instead of /...
r15447 adding a.i/b (glob)
Adrian Buehlmann
tests: unify test-fncache
r11865 $ hg ci -m second
Adrian Buehlmann
tests: sort fncache
r13389 $ cat .hg/store/fncache | sort
Adrian Buehlmann
tests: unify test-fncache
r11865 data/a.i
data/a.i.hg/b.i
Testing a.i.hg/c:
$ mkdir a.i.hg
$ echo "yet another text" > a.i.hg/c
$ hg add
Mads Kiilerich
tests: make (glob) on windows accept \ instead of /...
r15447 adding a.i.hg/c (glob)
Adrian Buehlmann
tests: unify test-fncache
r11865 $ hg ci -m third
Adrian Buehlmann
tests: sort fncache
r13389 $ cat .hg/store/fncache | sort
Adrian Buehlmann
tests: unify test-fncache
r11865 data/a.i
Adrian Buehlmann
tests: sort fncache
r13389 data/a.i.hg.hg/c.i
Adrian Buehlmann
tests: unify test-fncache
r11865 data/a.i.hg/b.i
Testing verify:
$ hg verify
checking changesets
checking manifests
crosschecking files in changesets and manifests
checking files
3 files, 3 changesets, 3 total revisions
$ rm .hg/store/fncache
$ hg verify
checking changesets
checking manifests
crosschecking files in changesets and manifests
checking files
data/a.i@0: missing revlog!
data/a.i.hg/c.i@2: missing revlog!
data/a.i/b.i@1: missing revlog!
3 files, 3 changesets, 3 total revisions
3 integrity errors encountered!
(first damaged changeset appears to be 0)
Matt Mackall
tests: add exit codes to unified tests
r12316 [1]
Adrian Buehlmann
tests: unify test-fncache
r11865 $ cd ..
Non store repo:
$ hg --config format.usestore=False init foo
$ cd foo
$ mkdir tst.d
$ echo foo > tst.d/foo
$ hg ci -Amfoo
adding tst.d/foo
$ find .hg | sort
.hg
.hg/00changelog.i
.hg/00manifest.i
Mads Kiilerich
localrepo: update branchcache in a more reliable way...
r15886 .hg/cache
Brodie Rao
branchmap: cache open/closed branch head information...
r20185 .hg/cache/branch2-served
Mads Kiilerich
branchmap: use revbranchcache when updating branch map...
r23786 .hg/cache/rbc-names-v1
.hg/cache/rbc-revs-v1
Adrian Buehlmann
tests: unify test-fncache
r11865 .hg/data
.hg/data/tst.d.hg
.hg/data/tst.d.hg/foo.i
.hg/dirstate
.hg/last-message.txt
Pierre-Yves David
phases: set new commit in 1-phase
r15483 .hg/phaseroots
Adrian Buehlmann
tests: unify test-fncache
r11865 .hg/requires
.hg/undo
Alexander Solovyov
fix bookmarks rollback behavior...
r14266 .hg/undo.bookmarks
Adrian Buehlmann
tests: unify test-fncache
r11865 .hg/undo.branch
.hg/undo.desc
.hg/undo.dirstate
Pierre-Yves David
phases: add rollback support
r15455 .hg/undo.phaseroots
Adrian Buehlmann
tests: unify test-fncache
r11865 $ cd ..
Non fncache repo:
$ hg --config format.usefncache=False init bar
$ cd bar
$ mkdir tst.d
$ echo foo > tst.d/Foo
$ hg ci -Amfoo
adding tst.d/Foo
$ find .hg | sort
.hg
.hg/00changelog.i
Mads Kiilerich
localrepo: update branchcache in a more reliable way...
r15886 .hg/cache
Brodie Rao
branchmap: cache open/closed branch head information...
r20185 .hg/cache/branch2-served
Mads Kiilerich
branchmap: use revbranchcache when updating branch map...
r23786 .hg/cache/rbc-names-v1
.hg/cache/rbc-revs-v1
Adrian Buehlmann
tests: unify test-fncache
r11865 .hg/dirstate
.hg/last-message.txt
.hg/requires
.hg/store
.hg/store/00changelog.i
.hg/store/00manifest.i
.hg/store/data
.hg/store/data/tst.d.hg
.hg/store/data/tst.d.hg/_foo.i
Pierre-Yves David
phases: set new commit in 1-phase
r15483 .hg/store/phaseroots
Adrian Buehlmann
tests: unify test-fncache
r11865 .hg/store/undo
Pierre-Yves David
phases: add rollback support
r15455 .hg/store/undo.phaseroots
Alexander Solovyov
fix bookmarks rollback behavior...
r14266 .hg/undo.bookmarks
Adrian Buehlmann
tests: unify test-fncache
r11865 .hg/undo.branch
.hg/undo.desc
.hg/undo.dirstate
$ cd ..
Adrian Buehlmann
test-fncache: test reserved / long paths...
r17710 Encoding of reserved / long paths in the store
$ hg init r2
$ cd r2
$ cat <<EOF > .hg/hgrc
> [ui]
> portablefilenames = ignore
> EOF
Adrian Buehlmann
test-fncache: enable for Windows...
r17748 $ hg import -q --bypass - <<EOF
> # HG changeset patch
> # User test
> # Date 0 0
> # Node ID 1c7a2f7cb77be1a0def34e4c7cabc562ad98fbd7
> # Parent 0000000000000000000000000000000000000000
> 1
>
> diff --git a/12345678/12345678/12345678/12345678/12345678/12345678/12345678/12345/xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-123456789-12.3456789-12345-ABCDEFGHIJKLMNOPRSTUVWXYZ-abcdefghjiklmnopqrstuvwxyz b/12345678/12345678/12345678/12345678/12345678/12345678/12345678/12345/xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-123456789-12.3456789-12345-ABCDEFGHIJKLMNOPRSTUVWXYZ-abcdefghjiklmnopqrstuvwxyz
> new file mode 100644
> --- /dev/null
> +++ b/12345678/12345678/12345678/12345678/12345678/12345678/12345678/12345/xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-123456789-12.3456789-12345-ABCDEFGHIJKLMNOPRSTUVWXYZ-abcdefghjiklmnopqrstuvwxyz
> @@ -0,0 +1,1 @@
> +foo
> diff --git a/AUX/SECOND/X.PRN/FOURTH/FI:FTH/SIXTH/SEVENTH/EIGHTH/NINETH/TENTH/ELEVENTH/LOREMIPSUM.TXT b/AUX/SECOND/X.PRN/FOURTH/FI:FTH/SIXTH/SEVENTH/EIGHTH/NINETH/TENTH/ELEVENTH/LOREMIPSUM.TXT
> new file mode 100644
> --- /dev/null
> +++ b/AUX/SECOND/X.PRN/FOURTH/FI:FTH/SIXTH/SEVENTH/EIGHTH/NINETH/TENTH/ELEVENTH/LOREMIPSUM.TXT
> @@ -0,0 +1,1 @@
> +foo
> diff --git a/Project Planning/Resources/AnotherLongDirectoryName/Followedbyanother/AndAnother/AndThenAnExtremelyLongFileName.txt b/Project Planning/Resources/AnotherLongDirectoryName/Followedbyanother/AndAnother/AndThenAnExtremelyLongFileName.txt
> new file mode 100644
> --- /dev/null
> +++ b/Project Planning/Resources/AnotherLongDirectoryName/Followedbyanother/AndAnother/AndThenAnExtremelyLongFileName.txt
> @@ -0,0 +1,1 @@
> +foo
> diff --git a/bla.aux/prn/PRN/lpt/com3/nul/coma/foo.NUL/normal.c b/bla.aux/prn/PRN/lpt/com3/nul/coma/foo.NUL/normal.c
> new file mode 100644
> --- /dev/null
> +++ b/bla.aux/prn/PRN/lpt/com3/nul/coma/foo.NUL/normal.c
> @@ -0,0 +1,1 @@
> +foo
> diff --git a/enterprise/openesbaddons/contrib-imola/corba-bc/netbeansplugin/wsdlExtension/src/main/java/META-INF/services/org.netbeans.modules.xml.wsdl.bindingsupport.spi.ExtensibilityElementTemplateProvider b/enterprise/openesbaddons/contrib-imola/corba-bc/netbeansplugin/wsdlExtension/src/main/java/META-INF/services/org.netbeans.modules.xml.wsdl.bindingsupport.spi.ExtensibilityElementTemplateProvider
> new file mode 100644
> --- /dev/null
> +++ b/enterprise/openesbaddons/contrib-imola/corba-bc/netbeansplugin/wsdlExtension/src/main/java/META-INF/services/org.netbeans.modules.xml.wsdl.bindingsupport.spi.ExtensibilityElementTemplateProvider
> @@ -0,0 +1,1 @@
> +foo
> EOF
Adrian Buehlmann
test-fncache: test reserved / long paths...
r17710 $ find .hg/store -name *.i | sort
.hg/store/00changelog.i
.hg/store/00manifest.i
.hg/store/data/bla.aux/pr~6e/_p_r_n/lpt/co~6d3/nu~6c/coma/foo._n_u_l/normal.c.i
.hg/store/dh/12345678/12345678/12345678/12345678/12345678/12345678/12345678/12345/xxxxxx168e07b38e65eff86ab579afaaa8e30bfbe0f35f.i
.hg/store/dh/au~78/second/x.prn/fourth/fi~3afth/sixth/seventh/eighth/nineth/tenth/loremia20419e358ddff1bf8751e38288aff1d7c32ec05.i
.hg/store/dh/enterpri/openesba/contrib-/corba-bc/netbeans/wsdlexte/src/main/java/org.net7018f27961fdf338a598a40c4683429e7ffb9743.i
.hg/store/dh/project_/resource/anotherl/followed/andanoth/andthenanextremelylongfilename0d8e1f4187c650e2f1fdca9fd90f786bc0976b6b.i
$ cd ..
Durham Goode
fncache: move fncache writing to be in a transaction...
r20883 Aborting lock does not prevent fncache writes
Adrian Buehlmann
test-fncache: test reserved / long paths...
r17710
Durham Goode
fncache: move fncache writing to be in a transaction...
r20883 $ cat > exceptionext.py <<EOF
> import os
> from mercurial import commands, util
> from mercurial.extensions import wrapfunction
>
> def lockexception(orig, vfs, lockname, wait, releasefn, acquirefn, desc):
> def releasewrap():
> raise util.Abort("forced lock failure")
> return orig(vfs, lockname, wait, releasewrap, acquirefn, desc)
>
> def reposetup(ui, repo):
> wrapfunction(repo, '_lock', lockexception)
>
> cmdtable = {}
>
> EOF
$ extpath=`pwd`/exceptionext.py
$ hg init fncachetxn
$ cd fncachetxn
$ printf "[extensions]\nexceptionext=$extpath\n" >> .hg/hgrc
$ touch y
$ hg ci -qAm y
abort: forced lock failure
[255]
$ cat .hg/store/fncache
data/y.i
Aborting transaction prevents fncache change
$ cat > ../exceptionext.py <<EOF
> import os
Pierre-Yves David
fncache: drop dedicated 'onclose' function in favor of 'tr.addfinalize'...
r23510 > from mercurial import commands, util, localrepo
Durham Goode
fncache: move fncache writing to be in a transaction...
r20883 > from mercurial.extensions import wrapfunction
>
> def wrapper(orig, self, *args, **kwargs):
Pierre-Yves David
fncache: drop dedicated 'onclose' function in favor of 'tr.addfinalize'...
r23510 > tr = orig(self, *args, **kwargs)
> def fail(tr):
Durham Goode
fncache: move fncache writing to be in a transaction...
r20883 > raise util.Abort("forced transaction failure")
Pierre-Yves David
fncache: drop dedicated 'onclose' function in favor of 'tr.addfinalize'...
r23510 > # zzz prefix to ensure it sorted after store.write
> tr.addfinalize('zzz-forcefails', fail)
> return tr
Durham Goode
fncache: move fncache writing to be in a transaction...
r20883 >
> def uisetup(ui):
Pierre-Yves David
fncache: drop dedicated 'onclose' function in favor of 'tr.addfinalize'...
r23510 > wrapfunction(localrepo.localrepository, 'transaction', wrapper)
Durham Goode
fncache: move fncache writing to be in a transaction...
r20883 >
> cmdtable = {}
>
> EOF
Matt Mackall
tests: ignore missing file with PYTHONDONTWRITEBYTECODE (issue4239)
r21760 $ rm -f "${extpath}c"
Durham Goode
fncache: move fncache writing to be in a transaction...
r20883 $ touch z
$ hg ci -qAm z
transaction abort!
rollback completed
abort: forced transaction failure
[255]
$ cat .hg/store/fncache
data/y.i
Durham Goode
transactions: fix hg recover with fncache backups...
r23063
Aborted transactions can be recovered later
$ cat > ../exceptionext.py <<EOF
> import os
Pierre-Yves David
transaction: remove the redundant 'onclose' mechanism...
r23512 > from mercurial import commands, util, transaction, localrepo
Durham Goode
transactions: fix hg recover with fncache backups...
r23063 > from mercurial.extensions import wrapfunction
>
Pierre-Yves David
transaction: remove the redundant 'onclose' mechanism...
r23512 > def trwrapper(orig, self, *args, **kwargs):
> tr = orig(self, *args, **kwargs)
> def fail(tr):
Durham Goode
transactions: fix hg recover with fncache backups...
r23063 > raise util.Abort("forced transaction failure")
Pierre-Yves David
transaction: remove the redundant 'onclose' mechanism...
r23512 > # zzz prefix to ensure it sorted after store.write
> tr.addfinalize('zzz-forcefails', fail)
> return tr
Durham Goode
transactions: fix hg recover with fncache backups...
r23063 >
> def abortwrapper(orig, self, *args, **kwargs):
> raise util.Abort("forced transaction failure")
>
> def uisetup(ui):
Pierre-Yves David
transaction: remove the redundant 'onclose' mechanism...
r23512 > wrapfunction(localrepo.localrepository, 'transaction', trwrapper)
Durham Goode
transactions: fix hg recover with fncache backups...
r23063 > wrapfunction(transaction.transaction, '_abort', abortwrapper)
>
> cmdtable = {}
>
> EOF
$ rm -f "${extpath}c"
$ hg up -q 1
$ touch z
$ hg ci -qAm z 2>/dev/null
[255]
$ cat .hg/store/fncache | sort
data/y.i
data/z.i
$ hg recover
rolling back interrupted transaction
checking changesets
checking manifests
crosschecking files in changesets and manifests
checking files
1 files, 1 changesets, 1 total revisions
$ cat .hg/store/fncache
data/y.i