##// 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:

r48232:86418ad6 default
r50337:81623652 default
Show More
test-narrow-patterns.t
461 lines | 9.9 KiB | text/troff | Tads3Lexer
/ tests / test-narrow-patterns.t
Augie Fackler
narrow: import experimental extension from narrowhg revision cb51d673e9c5...
r36096 $ . "$TESTDIR/narrow-library.sh"
initialize nested directories to validate complex include/exclude patterns
$ hg init master
$ cd master
$ cat >> .hg/hgrc <<EOF
> [narrow]
> serveellipses=True
> EOF
$ echo root > root
$ hg add root
$ hg commit -m 'add root'
$ for d in dir1 dir2 dir1/dirA dir1/dirB dir2/dirA dir2/dirB
> do
> mkdir -p $d
> echo $d/foo > $d/foo
> hg add $d/foo
> hg commit -m "add $d/foo"
> echo $d/bar > $d/bar
> hg add $d/bar
> hg commit -m "add $d/bar"
> done
Matt Harbison
test-narrow: partially stabilize on Windows...
r36153 #if execbit
Augie Fackler
narrow: import experimental extension from narrowhg revision cb51d673e9c5...
r36096 $ chmod +x dir1/dirA/foo
$ hg commit -m "make dir1/dirA/foo executable"
Matt Harbison
test-narrow: partially stabilize on Windows...
r36153 #else
$ hg import --bypass - <<EOF
> # HG changeset patch
> make dir1/dirA/foo executable
>
> diff --git a/dir1/dirA/foo b/dir1/dirA/foo
> old mode 100644
> new mode 100755
> EOF
applying patch from stdin
$ hg update -qr tip
#endif
Augie Fackler
narrow: import experimental extension from narrowhg revision cb51d673e9c5...
r36096 $ hg log -G -T '{rev} {node|short} {files}\n'
@ 13 c87ca422d521 dir1/dirA/foo
|
o 12 951b8a83924e dir2/dirB/bar
|
o 11 01ae5a51b563 dir2/dirB/foo
|
o 10 5eababdf0ac5 dir2/dirA/bar
|
o 9 99d690663739 dir2/dirA/foo
|
o 8 8e80155d5445 dir1/dirB/bar
|
o 7 406760310428 dir1/dirB/foo
|
o 6 623466a5f475 dir1/dirA/bar
|
o 5 06ff3a5be997 dir1/dirA/foo
|
o 4 33227af02764 dir2/bar
|
o 3 5e1f9d8d7c69 dir2/foo
|
o 2 594bc4b13d4a dir1/bar
|
o 1 47f480a08324 dir1/foo
|
o 0 2a4f0c3b67da root
$ cd ..
clone a narrow portion of the master, such that we can widen it later
$ hg clone --narrow ssh://user@dummy/master narrow \
> --include dir1 \
> --include dir2 \
> --exclude dir1/dirA \
> --exclude dir1/dirB \
> --exclude dir2/dirA \
> --exclude dir2/dirB
requesting all changes
adding changesets
adding manifests
adding file changes
added 6 changesets with 4 changes to 4 files
new changesets *:* (glob)
updating to branch default
4 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ cd narrow
Martin von Zweigbergk
tests: avoid unnecessarily looking inside .hg/ in test-narrow*...
r38873 $ hg tracked
I path:dir1
I path:dir2
X path:dir1/dirA
X path:dir1/dirB
X path:dir2/dirA
X path:dir2/dirB
Augie Fackler
narrow: import experimental extension from narrowhg revision cb51d673e9c5...
r36096 $ hg manifest -r tip
dir1/bar
dir1/dirA/bar
dir1/dirA/foo
dir1/dirB/bar
dir1/dirB/foo
dir1/foo
dir2/bar
dir2/dirA/bar
dir2/dirA/foo
dir2/dirB/bar
dir2/dirB/foo
dir2/foo
root
$ find * | sort
dir1
dir1/bar
dir1/foo
dir2
dir2/bar
dir2/foo
$ hg log -G -T '{rev} {node|short}{if(ellipsis, "...")} {files}\n'
@ 5 c87ca422d521... dir1/dirA/foo
|
o 4 33227af02764 dir2/bar
|
o 3 5e1f9d8d7c69 dir2/foo
|
o 2 594bc4b13d4a dir1/bar
|
o 1 47f480a08324 dir1/foo
|
o 0 2a4f0c3b67da... root
widen the narrow checkout
$ hg tracked --removeexclude dir1/dirA
comparing with ssh://user@dummy/master
searching for changes
saved backup bundle to $TESTTMP/narrow/.hg/strip-backup/*-widen.hg (glob)
adding changesets
adding manifests
adding file changes
Martin von Zweigbergk
narrowbundle: use new context manager for silencing the ui...
r48232 added 9 changesets with 6 changes to 10 files
Martin von Zweigbergk
tests: avoid unnecessarily looking inside .hg/ in test-narrow*...
r38873 $ hg tracked
I path:dir1
I path:dir2
X path:dir1/dirB
X path:dir2/dirA
X path:dir2/dirB
Augie Fackler
narrow: import experimental extension from narrowhg revision cb51d673e9c5...
r36096 $ find * | sort
dir1
dir1/bar
dir1/dirA
dir1/dirA/bar
dir1/dirA/foo
dir1/foo
dir2
dir2/bar
dir2/foo
Matt Harbison
test-narrow: partially stabilize on Windows...
r36153
#if execbit
Augie Fackler
narrow: import experimental extension from narrowhg revision cb51d673e9c5...
r36096 $ test -x dir1/dirA/foo && echo executable
executable
$ test -x dir1/dirA/bar || echo not executable
not executable
Matt Harbison
test-narrow: partially stabilize on Windows...
r36153 #endif
Augie Fackler
narrow: import experimental extension from narrowhg revision cb51d673e9c5...
r36096 $ hg log -G -T '{rev} {node|short}{if(ellipsis, "...")} {files}\n'
@ 8 c87ca422d521 dir1/dirA/foo
|
o 7 951b8a83924e... dir2/dirB/bar
|
o 6 623466a5f475 dir1/dirA/bar
|
o 5 06ff3a5be997 dir1/dirA/foo
|
o 4 33227af02764 dir2/bar
|
o 3 5e1f9d8d7c69 dir2/foo
|
o 2 594bc4b13d4a dir1/bar
|
o 1 47f480a08324 dir1/foo
|
o 0 2a4f0c3b67da... root
widen narrow spec again, but exclude a file in previously included spec
$ hg tracked --removeexclude dir2/dirB --addexclude dir1/dirA/bar
comparing with ssh://user@dummy/master
searching for changes
looking for local changes to affected paths
Gregory Szorc
tests: conditionalize tests for various repo features...
r37434 deleting data/dir1/dirA/bar.i (reporevlogstore !)
deleting data/dir1/dirA/bar/0eca1d0cbdaea4651d1d04d71976a6d2d9bfaae5 (reposimplestore !)
deleting data/dir1/dirA/bar/index (reposimplestore !)
Martin von Zweigbergk
narrow: add more status messages when narrowing...
r47800 deleting unwanted files from working copy
Augie Fackler
narrow: import experimental extension from narrowhg revision cb51d673e9c5...
r36096 saved backup bundle to $TESTTMP/narrow/.hg/strip-backup/*-widen.hg (glob)
adding changesets
adding manifests
adding file changes
Martin von Zweigbergk
narrowbundle: use new context manager for silencing the ui...
r48232 added 11 changesets with 7 changes to 12 files
Martin von Zweigbergk
tests: avoid unnecessarily looking inside .hg/ in test-narrow*...
r38873 $ hg tracked
I path:dir1
I path:dir2
X path:dir1/dirA/bar
X path:dir1/dirB
X path:dir2/dirA
Augie Fackler
narrow: import experimental extension from narrowhg revision cb51d673e9c5...
r36096 $ find * | sort
dir1
dir1/bar
dir1/dirA
dir1/dirA/foo
dir1/foo
dir2
dir2/bar
dir2/dirB
dir2/dirB/bar
dir2/dirB/foo
dir2/foo
$ hg log -G -T '{rev} {node|short}{if(ellipsis, "...")} {files}\n'
@ 10 c87ca422d521 dir1/dirA/foo
|
o 9 951b8a83924e dir2/dirB/bar
|
o 8 01ae5a51b563 dir2/dirB/foo
|
o 7 5eababdf0ac5... dir2/dirA/bar
|
o 6 623466a5f475... dir1/dirA/bar
|
o 5 06ff3a5be997 dir1/dirA/foo
|
o 4 33227af02764 dir2/bar
|
o 3 5e1f9d8d7c69 dir2/foo
|
o 2 594bc4b13d4a dir1/bar
|
o 1 47f480a08324 dir1/foo
|
o 0 2a4f0c3b67da... root
widen narrow spec yet again, excluding a directory in previous spec
$ hg tracked --removeexclude dir2/dirA --addexclude dir1/dirA
comparing with ssh://user@dummy/master
searching for changes
looking for local changes to affected paths
Gregory Szorc
tests: conditionalize tests for various repo features...
r37434 deleting data/dir1/dirA/foo.i (reporevlogstore !)
deleting data/dir1/dirA/foo/162caeb3d55dceb1fee793aa631ac8c73fcb8b5e (reposimplestore !)
deleting data/dir1/dirA/foo/index (reposimplestore !)
Martin von Zweigbergk
narrow: add more status messages when narrowing...
r47800 deleting unwanted files from working copy
Augie Fackler
narrow: import experimental extension from narrowhg revision cb51d673e9c5...
r36096 saved backup bundle to $TESTTMP/narrow/.hg/strip-backup/*-widen.hg (glob)
adding changesets
adding manifests
adding file changes
Martin von Zweigbergk
narrowbundle: use new context manager for silencing the ui...
r48232 added 13 changesets with 8 changes to 14 files
Martin von Zweigbergk
tests: avoid unnecessarily looking inside .hg/ in test-narrow*...
r38873 $ hg tracked
I path:dir1
I path:dir2
X path:dir1/dirA
X path:dir1/dirA/bar
X path:dir1/dirB
Augie Fackler
narrow: import experimental extension from narrowhg revision cb51d673e9c5...
r36096 $ find * | sort
dir1
dir1/bar
dir1/foo
dir2
dir2/bar
dir2/dirA
dir2/dirA/bar
dir2/dirA/foo
dir2/dirB
dir2/dirB/bar
dir2/dirB/foo
dir2/foo
$ hg log -G -T '{rev} {node|short}{if(ellipsis, "...")} {files}\n'
@ 12 c87ca422d521... dir1/dirA/foo
|
o 11 951b8a83924e dir2/dirB/bar
|
o 10 01ae5a51b563 dir2/dirB/foo
|
o 9 5eababdf0ac5 dir2/dirA/bar
|
o 8 99d690663739 dir2/dirA/foo
|
o 7 8e80155d5445... dir1/dirB/bar
|
o 6 623466a5f475... dir1/dirA/bar
|
o 5 06ff3a5be997... dir1/dirA/foo
|
o 4 33227af02764 dir2/bar
|
o 3 5e1f9d8d7c69 dir2/foo
|
o 2 594bc4b13d4a dir1/bar
|
o 1 47f480a08324 dir1/foo
|
o 0 2a4f0c3b67da... root
include a directory that was previously explicitly excluded
$ hg tracked --removeexclude dir1/dirA
comparing with ssh://user@dummy/master
searching for changes
saved backup bundle to $TESTTMP/narrow/.hg/strip-backup/*-widen.hg (glob)
adding changesets
adding manifests
adding file changes
Martin von Zweigbergk
narrowbundle: use new context manager for silencing the ui...
r48232 added 13 changesets with 9 changes to 17 files
Martin von Zweigbergk
tests: avoid unnecessarily looking inside .hg/ in test-narrow*...
r38873 $ hg tracked
I path:dir1
I path:dir2
X path:dir1/dirA/bar
X path:dir1/dirB
Augie Fackler
narrow: import experimental extension from narrowhg revision cb51d673e9c5...
r36096 $ find * | sort
dir1
dir1/bar
dir1/dirA
dir1/dirA/foo
dir1/foo
dir2
dir2/bar
dir2/dirA
dir2/dirA/bar
dir2/dirA/foo
dir2/dirB
dir2/dirB/bar
dir2/dirB/foo
dir2/foo
$ hg log -G -T '{rev} {node|short}{if(ellipsis, "...")} {files}\n'
@ 12 c87ca422d521 dir1/dirA/foo
|
o 11 951b8a83924e dir2/dirB/bar
|
o 10 01ae5a51b563 dir2/dirB/foo
|
o 9 5eababdf0ac5 dir2/dirA/bar
|
o 8 99d690663739 dir2/dirA/foo
|
o 7 8e80155d5445... dir1/dirB/bar
|
o 6 623466a5f475... dir1/dirA/bar
|
o 5 06ff3a5be997 dir1/dirA/foo
|
o 4 33227af02764 dir2/bar
|
o 3 5e1f9d8d7c69 dir2/foo
|
o 2 594bc4b13d4a dir1/bar
|
o 1 47f480a08324 dir1/foo
|
o 0 2a4f0c3b67da... root
$ cd ..
clone a narrow portion of the master, such that we can widen it later
$ hg clone --narrow ssh://user@dummy/master narrow2 --include dir1/dirA
requesting all changes
adding changesets
adding manifests
adding file changes
added 5 changesets with 2 changes to 2 files
new changesets *:* (glob)
updating to branch default
2 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ cd narrow2
$ find * | sort
dir1
dir1/dirA
dir1/dirA/bar
dir1/dirA/foo
$ hg tracked --addinclude dir1
comparing with ssh://user@dummy/master
searching for changes
saved backup bundle to $TESTTMP/narrow2/.hg/strip-backup/*-widen.hg (glob)
adding changesets
adding manifests
adding file changes
Martin von Zweigbergk
narrowbundle: use new context manager for silencing the ui...
r48232 added 10 changesets with 6 changes to 8 files
Augie Fackler
narrow: import experimental extension from narrowhg revision cb51d673e9c5...
r36096 $ find * | sort
dir1
dir1/bar
dir1/dirA
dir1/dirA/bar
dir1/dirA/foo
dir1/dirB
dir1/dirB/bar
dir1/dirB/foo
dir1/foo
$ hg log -G -T '{rev} {node|short}{if(ellipsis, "...")} {files}\n'
@ 9 c87ca422d521 dir1/dirA/foo
|
o 8 951b8a83924e... dir2/dirB/bar
|
o 7 8e80155d5445 dir1/dirB/bar
|
o 6 406760310428 dir1/dirB/foo
|
o 5 623466a5f475 dir1/dirA/bar
|
o 4 06ff3a5be997 dir1/dirA/foo
|
o 3 33227af02764... dir2/bar
|
o 2 594bc4b13d4a dir1/bar
|
o 1 47f480a08324 dir1/foo
|
o 0 2a4f0c3b67da... root
Gregory Szorc
narrowspec: limit patterns to path: and rootfilesin: (BC)...
r39567
Illegal patterns are rejected
$ hg tracked --addinclude glob:**
abort: invalid prefix on narrow pattern: glob:**
(narrow patterns must begin with one of the following: path:, rootfilesin:)
[255]
$ hg tracked --addexclude set:ignored
abort: invalid prefix on narrow pattern: set:ignored
(narrow patterns must begin with one of the following: path:, rootfilesin:)
[255]
Gregory Szorc
narrowspec: validate patterns when loading and saving spec file...
r39575
$ cat .hg/store/narrowspec
[include]
path:dir1
path:dir1/dirA
[exclude]
$ cat > .hg/store/narrowspec << EOF
> [include]
> glob:**
> EOF
$ hg tracked
abort: invalid prefix on narrow pattern: glob:**
(narrow patterns must begin with one of the following: path:, rootfilesin:)
[255]
$ cat > .hg/store/narrowspec << EOF
> [include]
> path:.
> [exclude]
> set:ignored
> EOF
$ hg tracked
abort: invalid prefix on narrow pattern: set:ignored
(narrow patterns must begin with one of the following: path:, rootfilesin:)
[255]