##// END OF EJS Templates
narrow: fix flaky behavior described in issue6150...
narrow: fix flaky behavior described in issue6150 This has been plaguing the CI for a good while, and it doesn't appear to have an easy fix proposed yet. The solution in this change is to always do an unambiguous (but expensive) lookup in case of comparison. This should always be correct, albeit suboptimal. Differential Revision: https://phab.mercurial-scm.org/D10034

File last commit:

r46273:a736ab68 default
r47280:b994db7c stable
Show More
test-fncache.t
545 lines | 15.2 KiB | text/troff | Tads3Lexer
Gregory Szorc
simplestore: use a custom store for the simple store repo...
r37433 #require repofncache
Pulkit Goyal
store: don't read the whole fncache in memory...
r42144 An extension which will set fncache chunksize to 1 byte to make sure that logic
does not break
$ cat > chunksize.py <<EOF
> from __future__ import absolute_import
> from mercurial import store
> store.fncache_chunksize = 1
> EOF
$ cat >> $HGRCPATH <<EOF
> [extensions]
> chunksize = $TESTTMP/chunksize.py
> EOF
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
Matt Harbison
tests: remove (glob) annotations that were only for '\' matches...
r35394 adding a.i/b
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
Matt Harbison
tests: remove (glob) annotations that were only for '\' matches...
r35394 adding a.i.hg/c
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
Meirambek Omyrzak
verify: make output less confusing (issue5924)...
r39525 checked 3 changesets with 3 changes to 3 files
Adrian Buehlmann
tests: unify test-fncache
r11865
$ rm .hg/store/fncache
$ hg verify
checking changesets
checking manifests
crosschecking files in changesets and manifests
checking files
Matt Mackall
verify: clarify misleading fncache message...
r25627 warning: revlog 'data/a.i' not in fncache!
warning: revlog 'data/a.i.hg/c.i' not in fncache!
warning: revlog 'data/a.i/b.i' not in fncache!
Meirambek Omyrzak
verify: make output less confusing (issue5924)...
r39525 checked 3 changesets with 3 changes to 3 files
Matt Mackall
verify: clarify misleading fncache message...
r25627 3 warnings encountered!
Gregory Szorc
verify: print hint to run debugrebuildfncache...
r25653 hint: run "hg debugrebuildfncache" to recover from corrupt fncache
Follow the hint to make sure it works
$ hg debugrebuildfncache
adding data/a.i
adding data/a.i.hg/c.i
adding data/a.i/b.i
3 items added, 0 removed from fncache
$ hg verify
checking changesets
checking manifests
crosschecking files in changesets and manifests
checking files
Meirambek Omyrzak
verify: make output less confusing (issue5924)...
r39525 checked 3 changesets with 3 changes to 3 files
Gregory Szorc
verify: print hint to run debugrebuildfncache...
r25653
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
FUJIWARA Katsunori
tests: add extra output for fsmonitor at checking under .hg
r33427 .hg/fsmonitor.state (fsmonitor !)
Adrian Buehlmann
tests: unify test-fncache
r11865 .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
Laurent Charignon
localrepo: put bookmark move following commit in one transaction...
r26998 .hg/undo.backup.dirstate
Pierre-Yves David
transaction: include backup file in the "undo" transaction...
r23904 .hg/undo.backupfiles
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
Boris Feld
check-exec: write file in 'wcache' instead of 'cache'...
r40823 .hg/wcache
Matt Harbison
tests: stabilize for recent wcache changes...
r40843 .hg/wcache/checkisexec (execbit !)
.hg/wcache/checklink (symlink !)
.hg/wcache/checklink-target (symlink !)
manifestcache: use `wcache` directory for manifest cache...
r42131 .hg/wcache/manifestfulltextcache (reporevlogstore !)
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
FUJIWARA Katsunori
tests: add extra output for fsmonitor at checking under .hg
r33427 .hg/fsmonitor.state (fsmonitor !)
Adrian Buehlmann
tests: unify test-fncache
r11865 .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
transaction: include backup file in the "undo" transaction...
r23904 .hg/store/undo.backupfiles
Pierre-Yves David
phases: add rollback support
r15455 .hg/store/undo.phaseroots
Laurent Charignon
localrepo: put bookmark move following commit in one transaction...
r26998 .hg/undo.backup.dirstate
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
Boris Feld
check-exec: write file in 'wcache' instead of 'cache'...
r40823 .hg/wcache
Matt Harbison
tests: stabilize for recent wcache changes...
r40843 .hg/wcache/checkisexec (execbit !)
.hg/wcache/checklink (symlink !)
.hg/wcache/checklink-target (symlink !)
manifestcache: use `wcache` directory for manifest cache...
r42131 .hg/wcache/manifestfulltextcache (reporevlogstore !)
Adrian Buehlmann
tests: unify test-fncache
r11865 $ 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
Augie Fackler
tests: update test-fncache to pass our import checker
r33958 > from __future__ import absolute_import
Durham Goode
fncache: move fncache writing to be in a transaction...
r20883 > import os
Augie Fackler
tests: update test-fncache to pass our import checker
r33958 > from mercurial import commands, error, extensions
Durham Goode
fncache: move fncache writing to be in a transaction...
r20883 >
Siddharth Agarwal
test-fncache: use args/kwargs for lock wrapper...
r26497 > def lockexception(orig, vfs, lockname, wait, releasefn, *args, **kwargs):
Durham Goode
fncache: move fncache writing to be in a transaction...
r20883 > def releasewrap():
Augie Fackler
test-fncache: ensure lock doesn't look held to __del__...
r27168 > l.held = False # ensure __del__ is a noop
Martin von Zweigbergk
errors: stop passing non-strings to Abort's constructor...
r46273 > raise error.Abort(b"forced lock failure")
Augie Fackler
test-fncache: ensure lock doesn't look held to __del__...
r27168 > l = orig(vfs, lockname, wait, releasewrap, *args, **kwargs)
> return l
Durham Goode
fncache: move fncache writing to be in a transaction...
r20883 >
> def reposetup(ui, repo):
Augie Fackler
tests: update test-fncache to pass our import checker
r33958 > extensions.wrapfunction(repo, '_lock', lockexception)
Durham Goode
fncache: move fncache writing to be in a transaction...
r20883 >
> cmdtable = {}
>
FUJIWARA Katsunori
commands: make commit acquire locks before processing (issue4368)...
r27192 > # wrap "commit" command to prevent wlock from being '__del__()'-ed
> # at the end of dispatching (for intentional "forced lcok failure")
> def commitwrap(orig, ui, repo, *pats, **opts):
> repo = repo.unfiltered() # to use replaced repo._lock certainly
> wlock = repo.wlock()
> try:
> return orig(ui, repo, *pats, **opts)
> finally:
> # multiple 'relase()' is needed for complete releasing wlock,
> # because "forced" abort at last releasing store lock
> # prevents wlock from being released at same 'lockmod.release()'
> for i in range(wlock.held):
> wlock.release()
>
> def extsetup(ui):
Pulkit Goyal
py3: add a b'' prefix in tests/test-fncache.t...
r36511 > extensions.wrapcommand(commands.table, b"commit", commitwrap)
Durham Goode
fncache: move fncache writing to be in a transaction...
r20883 > 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
Augie Fackler
tests: update test-fncache to pass our import checker
r33958 > from __future__ import absolute_import
Durham Goode
fncache: move fncache writing to be in a transaction...
r20883 > import os
Augie Fackler
tests: update test-fncache to pass our import checker
r33958 > from mercurial import commands, error, extensions, localrepo
Durham Goode
fncache: move fncache writing to be in a transaction...
r20883 >
> 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):
Augie Fackler
tests: fix bytes literals in test-fncache.t...
r36680 > raise error.Abort(b"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
Augie Fackler
tests: fix bytes literals in test-fncache.t...
r36680 > tr.addfinalize(b'zzz-forcefails', fail)
Pierre-Yves David
fncache: drop dedicated 'onclose' function in favor of 'tr.addfinalize'...
r23510 > return tr
Durham Goode
fncache: move fncache writing to be in a transaction...
r20883 >
> def uisetup(ui):
Augie Fackler
tests: update test-fncache to pass our import checker
r33958 > extensions.wrapfunction(
Augie Fackler
tests: fix bytes literals in test-fncache.t...
r36680 > localrepo.localrepository, b'transaction', wrapper)
Durham Goode
fncache: move fncache writing to be in a transaction...
r20883 >
> cmdtable = {}
>
> EOF
Boris Feld
pypy: fix failing test files with Pypy5.6.0...
r33609
Clean cached version
Matt Mackall
tests: ignore missing file with PYTHONDONTWRITEBYTECODE (issue4239)
r21760 $ rm -f "${extpath}c"
Boris Feld
pypy: fix failing test files with Pypy5.6.0...
r33609 $ rm -Rf "`dirname $extpath`/__pycache__"
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
Augie Fackler
tests: update test-fncache to pass our import checker
r33958 > from __future__ import absolute_import
Durham Goode
transactions: fix hg recover with fncache backups...
r23063 > import os
Augie Fackler
tests: update test-fncache to pass our import checker
r33958 > from mercurial import (
> commands,
> error,
> extensions,
> localrepo,
> transaction,
> )
Durham Goode
transactions: fix hg recover with fncache backups...
r23063 >
Pierre-Yves David
transaction: remove the redundant 'onclose' mechanism...
r23512 > def trwrapper(orig, self, *args, **kwargs):
> tr = orig(self, *args, **kwargs)
> def fail(tr):
Augie Fackler
tests: fix inline extension in test-fncache.t for Python 3...
r40298 > raise error.Abort(b"forced transaction failure")
Pierre-Yves David
transaction: remove the redundant 'onclose' mechanism...
r23512 > # zzz prefix to ensure it sorted after store.write
Augie Fackler
tests: fix inline extension in test-fncache.t for Python 3...
r40298 > tr.addfinalize(b'zzz-forcefails', fail)
Pierre-Yves David
transaction: remove the redundant 'onclose' mechanism...
r23512 > return tr
Durham Goode
transactions: fix hg recover with fncache backups...
r23063 >
> def abortwrapper(orig, self, *args, **kwargs):
Augie Fackler
tests: fix inline extension in test-fncache.t for Python 3...
r40298 > raise error.Abort(b"forced transaction failure")
Durham Goode
transactions: fix hg recover with fncache backups...
r23063 >
> def uisetup(ui):
Augie Fackler
tests: update test-fncache to pass our import checker
r33958 > extensions.wrapfunction(localrepo.localrepository, 'transaction',
> trwrapper)
> extensions.wrapfunction(transaction.transaction, '_abort',
> abortwrapper)
Durham Goode
transactions: fix hg recover with fncache backups...
r23063 >
> cmdtable = {}
>
> EOF
Boris Feld
pypy: fix failing test files with Pypy5.6.0...
r33609
Clean cached versions
Durham Goode
transactions: fix hg recover with fncache backups...
r23063 $ rm -f "${extpath}c"
Boris Feld
pypy: fix failing test files with Pypy5.6.0...
r33609 $ rm -Rf "`dirname $extpath`/__pycache__"
Durham Goode
transactions: fix hg recover with fncache backups...
r23063 $ 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
Valentin Gatien-Baron
recover: don't verify by default...
r44830 $ hg recover --verify
Durham Goode
transactions: fix hg recover with fncache backups...
r23063 rolling back interrupted transaction
checking changesets
checking manifests
crosschecking files in changesets and manifests
checking files
Meirambek Omyrzak
verify: make output less confusing (issue5924)...
r39525 checked 1 changesets with 1 changes to 1 files
Durham Goode
transactions: fix hg recover with fncache backups...
r23063 $ cat .hg/store/fncache
data/y.i
Gregory Szorc
repair: add functionality to rebuild fncache...
r25652
$ cd ..
debugrebuildfncache does nothing unless repo has fncache requirement
$ hg --config format.usefncache=false init nofncache
$ cd nofncache
$ hg debugrebuildfncache
Wagner Bruna
repair: fix typo in warning message
r25874 (not rebuilding fncache because repository does not support fncache)
Gregory Szorc
repair: add functionality to rebuild fncache...
r25652
$ cd ..
debugrebuildfncache works on empty repository
$ hg init empty
$ cd empty
$ hg debugrebuildfncache
fncache already up to date
$ cd ..
debugrebuildfncache on an up to date repository no-ops
$ hg init repo
$ cd repo
$ echo initial > foo
$ echo initial > .bar
$ hg commit -A -m initial
adding .bar
adding foo
$ cat .hg/store/fncache | sort
data/.bar.i
data/foo.i
$ hg debugrebuildfncache
fncache already up to date
debugrebuildfncache restores deleted fncache file
$ rm -f .hg/store/fncache
$ hg debugrebuildfncache
adding data/.bar.i
adding data/foo.i
2 items added, 0 removed from fncache
$ cat .hg/store/fncache | sort
data/.bar.i
data/foo.i
Rebuild after rebuild should no-op
$ hg debugrebuildfncache
fncache already up to date
A single missing file should get restored, an extra file should be removed
$ cat > .hg/store/fncache << EOF
> data/foo.i
> data/bad-entry.i
> EOF
$ hg debugrebuildfncache
removing data/bad-entry.i
adding data/.bar.i
1 items added, 1 removed from fncache
$ cat .hg/store/fncache | sort
data/.bar.i
data/foo.i
Valentin Gatien-Baron
fncache: make debugrebuildfncache not fail on broken fncache...
r42960 debugrebuildfncache recovers from truncated line in fncache
Valentin Gatien-Baron
fncache: show that debugrebuildfncache is partly broken...
r42959
$ printf a > .hg/store/fncache
$ hg debugrebuildfncache
Valentin Gatien-Baron
fncache: make debugrebuildfncache not fail on broken fncache...
r42960 fncache does not ends with a newline
adding data/.bar.i
adding data/foo.i
2 items added, 0 removed from fncache
Valentin Gatien-Baron
fncache: show that debugrebuildfncache is partly broken...
r42959
$ cat .hg/store/fncache | sort
Valentin Gatien-Baron
fncache: make debugrebuildfncache not fail on broken fncache...
r42960 data/.bar.i
data/foo.i
Valentin Gatien-Baron
fncache: show that debugrebuildfncache is partly broken...
r42959
Gregory Szorc
repair: add functionality to rebuild fncache...
r25652 $ cd ..
Try a simple variation without dotencode to ensure fncache is ignorant of encoding
$ hg --config format.dotencode=false init nodotencode
$ cd nodotencode
$ echo initial > foo
$ echo initial > .bar
$ hg commit -A -m initial
adding .bar
adding foo
$ cat .hg/store/fncache | sort
data/.bar.i
data/foo.i
$ rm .hg/store/fncache
$ hg debugrebuildfncache
adding data/.bar.i
adding data/foo.i
2 items added, 0 removed from fncache
$ cat .hg/store/fncache | sort
data/.bar.i
data/foo.i
Martijn Pieters
fncache: avoid loading the filename cache when not actually modifying it...
r38683
$ cd ..
In repositories that have accumulated a large number of files over time, the
fncache file is going to be large. If we possibly can avoid loading it, so much the better.
The cache should not loaded when committing changes to existing files, or when unbundling
changesets that only contain changes to existing files:
$ cat > fncacheloadwarn.py << EOF
> from __future__ import absolute_import
Gregory Szorc
localrepo: move store() from store module...
r39734 > from mercurial import extensions, localrepo
Martijn Pieters
fncache: avoid loading the filename cache when not actually modifying it...
r38683 >
> def extsetup(ui):
> def wrapstore(orig, requirements, *args):
> store = orig(requirements, *args)
Augie Fackler
tests: fix inline extension in test-fncache.t for Python 3...
r40298 > if b'store' in requirements and b'fncache' in requirements:
Martijn Pieters
fncache: avoid loading the filename cache when not actually modifying it...
r38683 > instrumentfncachestore(store, ui)
> return store
Gregory Szorc
localrepo: move store() from store module...
r39734 > extensions.wrapfunction(localrepo, 'makestore', wrapstore)
Martijn Pieters
fncache: avoid loading the filename cache when not actually modifying it...
r38683 >
> def instrumentfncachestore(fncachestore, ui):
> class instrumentedfncache(type(fncachestore.fncache)):
> def _load(self):
Augie Fackler
tests: fix inline extension in test-fncache.t for Python 3...
r40298 > ui.warn(b'fncache load triggered!\n')
Martijn Pieters
fncache: avoid loading the filename cache when not actually modifying it...
r38683 > super(instrumentedfncache, self)._load()
> fncachestore.fncache.__class__ = instrumentedfncache
> EOF
$ fncachextpath=`pwd`/fncacheloadwarn.py
$ hg init nofncacheload
$ cd nofncacheload
$ printf "[extensions]\nfncacheloadwarn=$fncachextpath\n" >> .hg/hgrc
A new file should trigger a load, as we'd want to update the fncache set in that case:
$ touch foo
$ hg ci -qAm foo
fncache load triggered!
But modifying that file should not:
$ echo bar >> foo
$ hg ci -qm foo
If a transaction has been aborted, the zero-size truncated index file will
not prevent the fncache from being loaded; rather than actually abort
a transaction, we simulate the situation by creating a zero-size index file:
$ touch .hg/store/data/bar.i
$ touch bar
$ hg ci -qAm bar
fncache load triggered!
Unbundling should follow the same rules; existing files should not cause a load:
$ hg clone -q . tobundle
$ echo 'new line' > tobundle/bar
$ hg -R tobundle ci -qm bar
$ hg -R tobundle bundle -q barupdated.hg
$ hg unbundle -q barupdated.hg
but adding new files should:
$ touch tobundle/newfile
$ hg -R tobundle ci -qAm newfile
$ hg -R tobundle bundle -q newfile.hg
$ hg unbundle -q newfile.hg
fncache load triggered!
$ cd ..