##// END OF EJS Templates
bisect: avoid adding irrelevant revisions to bisect state...
bisect: avoid adding irrelevant revisions to bisect state When adding new revisions to the bisect state, it only makes sense to add information about revisions that are under consideration (i.e., those that are topologically between the known good and bad revisions). However, if the user passes in a revset (e.g., '!merge()' to exclude merge commits), hg will resolve the revset first and add all matching revisions to the bisect state (which in this case would likely be the majority of revisions in the repo). To avoid this, revisions should only be added to the bisect state if they are between the good and bad revisions (and therefore relevant to the bisection). -- Here are the results of some performance tests using the `mozilla-central` repo (since it is one of the largest freely-available hg repositories in the wild). These tests compare the performance of a locally-built `hg` before and after application of this series. Note that `--noupdate` is passed to avoid including update time (which should not vary across cases). Setup (run between each test): $ hg bisect --reset $ hg bisect --noupdate --bad 56c3ad4bde5c70714b784ccf15d099e0df0f5bde $ hg bisect --noupdate --good 57426696adaf08298af3027fa77486fee0633b13 Test using a revset that returns a very large number of revisions: $ time hg bisect --noupdate --skip '!merge()' > /dev/null Before: real 0m9.398s user 0m9.233s sys 0m0.120s After: real 0m1.513s user 0m1.425s sys 0m0.052s Test using a revset that is expensive to compute: $ time hg bisect --noupdate --skip 'desc("Bug")' > /dev/null Before: real 0m49.853s user 0m49.580s sys 0m0.243s After: real 0m4.120s user 0m4.036s sys 0m0.048s

File last commit:

r49044:7ed0fc68 default
r50337:81623652 default
Show More
test-narrow-share.t
198 lines | 4.9 KiB | text/troff | Tads3Lexer
/ tests / test-narrow-share.t
Martin von Zweigbergk
tests: add test for narrow+share...
r41071 #testcases flat tree
Pulkit Goyal
share: introduce config option to store requires in .hg/store...
r46055 #testcases safe normal
#if safe
$ echo "[format]" >> $HGRCPATH
$ echo "exp-share-safe = True" >> $HGRCPATH
#endif
Martin von Zweigbergk
tests: add test for narrow+share...
r41071
$ . "$TESTDIR/narrow-library.sh"
#if tree
$ cat << EOF >> $HGRCPATH
> [experimental]
> treemanifest = 1
> EOF
#endif
$ cat << EOF >> $HGRCPATH
> [extensions]
> share =
> EOF
$ hg init remote
$ cd remote
$ for x in `$TESTDIR/seq.py 0 10`
> do
> mkdir d$x
> echo $x > d$x/f
> hg add d$x/f
> hg commit -m "add d$x/f"
> done
$ cd ..
$ hg clone --narrow ssh://user@dummy/remote main -q \
> --include d1 --include d3 --include d5 --include d7
Martin von Zweigbergk
narrow: also warn when not deleting untracked or ignored files...
r42352 Ignore file called "ignored"
$ echo ignored > main/.hgignore
Martin von Zweigbergk
tests: add test for narrow+share...
r41071 $ hg share main share
updating working directory
4 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ hg -R share tracked
I path:d1
I path:d3
I path:d5
I path:d7
$ hg -R share files
share/d1/f
share/d3/f
share/d5/f
share/d7/f
Narrow the share and check that the main repo's working copy gets updated
Martin von Zweigbergk
tests: de-flake test-narrow-share.t by making dirstate predictable...
r41217 # Make sure the files that are supposed to be known-clean get their timestamps set in the dirstate
$ sleep 2
$ hg -R main st
$ hg -R main debugdirstate --no-dates
n 644 2 set d1/f
n 644 2 set d3/f
n 644 2 set d5/f
n 644 2 set d7/f
Martin von Zweigbergk
tests: add test for narrow+share...
r41071 # Make d3/f dirty
$ echo x >> main/d3/f
$ echo y >> main/d3/g
Martin von Zweigbergk
narrow: also warn when not deleting untracked or ignored files...
r42352 $ touch main/d3/ignored
$ touch main/d3/untracked
Martin von Zweigbergk
tests: add test for narrow+share...
r41071 $ hg add main/d3/g
$ hg -R main st
M d3/f
A d3/g
Martin von Zweigbergk
narrow: also warn when not deleting untracked or ignored files...
r42352 ? d3/untracked
Martin von Zweigbergk
tests: add test for narrow+share...
r41071 # Make d5/f not match the dirstate timestamp even though it's clean
$ sleep 2
$ hg -R main st
M d3/f
A d3/g
Martin von Zweigbergk
narrow: also warn when not deleting untracked or ignored files...
r42352 ? d3/untracked
Martin von Zweigbergk
tests: add test for narrow+share...
r41071 $ hg -R main debugdirstate --no-dates
n 644 2 set d1/f
Martin von Zweigbergk
tests: de-flake test-narrow-share.t by making dirstate predictable...
r41217 n 644 2 set d3/f
Martin von Zweigbergk
tests: add test for narrow+share...
r41071 a 0 -1 unset d3/g
n 644 2 set d5/f
n 644 2 set d7/f
$ touch main/d5/f
$ hg -R share tracked --removeinclude d1 --removeinclude d3 --removeinclude d5
comparing with ssh://user@dummy/remote
searching for changes
looking for local changes to affected paths
deleting data/d1/f.i
deleting data/d3/f.i
deleting data/d5/f.i
deleting meta/d1/00manifest.i (tree !)
deleting meta/d3/00manifest.i (tree !)
deleting meta/d5/00manifest.i (tree !)
Martin von Zweigbergk
narrow: add more status messages when narrowing...
r47800 deleting unwanted files from working copy
Martin von Zweigbergk
tests: add test for narrow+share...
r41071 $ hg -R main tracked
I path:d7
Martin von Zweigbergk
narrow: detect if narrowspec was changed in a different share...
r41072 $ hg -R main files
abort: working copy's narrowspec is stale
(run 'hg tracked --update-working-copy')
Martin von Zweigbergk
narrow: raise StateError when working copy is stale (for detailed exit code)...
r49044 [20]
Martin von Zweigbergk
narrow: detect if narrowspec was changed in a different share...
r41072 $ hg -R main tracked --update-working-copy
not deleting possibly dirty file d3/f
not deleting possibly dirty file d3/g
not deleting possibly dirty file d5/f
Martin von Zweigbergk
narrow: also warn when not deleting untracked or ignored files...
r42352 not deleting unknown file d3/untracked
not deleting ignored file d3/ignored
Martin von Zweigbergk
tests: add test for narrow+share...
r41071 # d1/f, d3/f, d3/g and d5/f should no longer be reported
$ hg -R main files
main/d7/f
# d1/f should no longer be there, d3/f should be since it was dirty, d3/g should be there since
# it was added, and d5/f should be since we couldn't be sure it was clean
$ find main/d* -type f | sort
main/d3/f
main/d3/g
Martin von Zweigbergk
narrow: also warn when not deleting untracked or ignored files...
r42352 main/d3/ignored
main/d3/untracked
Martin von Zweigbergk
tests: add test for narrow+share...
r41071 main/d5/f
main/d7/f
Widen the share and check that the main repo's working copy gets updated
$ hg -R share tracked --addinclude d1 --addinclude d3 -q
$ hg -R share tracked
I path:d1
I path:d3
I path:d7
$ hg -R share files
share/d1/f
share/d3/f
share/d7/f
$ hg -R main tracked
I path:d1
I path:d3
I path:d7
Martin von Zweigbergk
narrow: detect if narrowspec was changed in a different share...
r41072 $ hg -R main files
abort: working copy's narrowspec is stale
(run 'hg tracked --update-working-copy')
Martin von Zweigbergk
narrow: raise StateError when working copy is stale (for detailed exit code)...
r49044 [20]
Martin von Zweigbergk
narrow: detect if narrowspec was changed in a different share...
r41072 $ hg -R main tracked --update-working-copy
Martin von Zweigbergk
tests: add test for narrow+share...
r41071 # d1/f, d3/f should be back
$ hg -R main files
main/d1/f
main/d3/f
main/d7/f
# d3/f should be modified (not clobbered by the widening), and d3/g should be untracked
$ hg -R main st --all
M d3/f
Martin von Zweigbergk
narrow: detect if narrowspec was changed in a different share...
r41072 ? d3/g
Martin von Zweigbergk
narrow: also warn when not deleting untracked or ignored files...
r42352 ? d3/untracked
I d3/ignored
Martin von Zweigbergk
tests: add test for narrow+share...
r41071 C d1/f
C d7/f
We should also be able to unshare without breaking everything:
$ hg share main share-unshare
updating working directory
3 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ cd share-unshare
$ hg unshare
$ hg verify
checking changesets
checking manifests
checking directory manifests (tree !)
crosschecking files in changesets and manifests
checking files
checked 11 changesets with 3 changes to 3 files
$ cd ..
Martin von Zweigbergk
narrow: detect if narrowspec was changed in a different share...
r41072
Dirstate should be left alone when upgrading from version of hg that didn't support narrow+share
$ hg share main share-upgrade
updating working directory
3 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ cd share-upgrade
$ echo x >> d1/f
$ echo y >> d3/g
$ hg add d3/g
$ hg rm d7/f
$ hg st
M d1/f
A d3/g
R d7/f
Make it look like a repo from before narrow+share was supported
$ rm .hg/narrowspec.dirstate
Martin von Zweigbergk
narrow: fix crash when restoring backup in legacy repo...
r41334 $ hg ci -Am test
Martin von Zweigbergk
narrow: detect if narrowspec was changed in a different share...
r41072 abort: working copy's narrowspec is stale
(run 'hg tracked --update-working-copy')
Martin von Zweigbergk
narrow: raise StateError when working copy is stale (for detailed exit code)...
r49044 [20]
Martin von Zweigbergk
narrow: detect if narrowspec was changed in a different share...
r41072 $ hg tracked --update-working-copy
$ hg st
M d1/f
A d3/g
R d7/f
$ cd ..