Mercurial > hg
view tests/test-narrow.t @ 43198:c16fe77e340a
pathcopies: give up any optimization based on `introrev`
Between 8a0136f69027 and d98fb3f42f33, we sped up the search for the
introduction revision during path copies. However, further checking show that
finding the introduction revision is still expensive and that we are better off
without it. So we simply drop it and only rely on the linkrev optimisation.
I ran `perfpathcopies` on 6989 pair of revision in the pypy
repository (`hg perfhelper-pathcopies`. The result is massively in favor of
dropping this condition. The result of the copy tracing are unchanged.
Attempt to use a smaller changes preserving linkrev usage were unsuccessful, it
can return wrong result. The following changesets broke test-mv-cp-st-diff.t
- if not f.isintroducedafter(limit):
+ if limit >= 0 and f.linkrev() < limit:
return None
Here are various numbers (before this changeset/after this changesets)
source destination before after saved-time ratio
worth cases e66f24650daf 695dfb0f493b 1.062843 1.246369 -0.183526 1.172675
c979853a3b6a 8d60fe293e79 1.036985 1.196414 -0.159429 1.153743
22349fa2fc33 fbb1c9fd86c0 0.879926 1.038682 -0.158756 1.180420
682b98f3e672 a4878080a536 0.909952 1.063801 -0.153849 1.169074
5adabc9b9848 920958a93997 0.993622 1.147452 -0.153830 1.154817
worse 1% dbfbfcf077e9 aea8f2fd3593 1.016595 1.082999 -0.066404 1.065320
worse 5% c95f1ced15f2 7d29d5e39734 0.453694 0.471156 -0.017462 1.038488
worse 10% 3e144ed1d5b7 2aef0e942480 0.035140 0.037535 -0.002395 1.068156
worse 25% 321fc60db035 801748ba582a 0.009267 0.009325 -0.000058 1.006259
median 2088ce763fc2 e6991321d78b 0.000665 0.000651 0.000014 0.978947
best 25% 915631a97de6 385b31354be6 0.040743 0.040363 0.000380 0.990673
best 10% ad495c36a765 19c10384d3e7 0.431658 0.411490 0.020168 0.953278
best 5% d13ae7d283ae 813c99f810ac 1.141404 1.075346 0.066058 0.942126
best 1% 81593cb4a496 99ae11866969 1.833297 0.063823 1.769474 0.034813
best cases c3b14617fbd7 743a0fcaa4eb 1101.811740 2.735970 1099.075770 0.002483
c3b14617fbd7 9ba6ab77fd29 1116.753953 2.800729 1113.953224 0.002508
058b99d6e81f 57e249b7a3ea 1246.128485 3.042762 1243.085723 0.002442
9a8c361aab49 0354a250d371 1253.111894 3.085796 1250.026098 0.002463
442dbbc53c68 3ec1002a818c 1261.786294 3.138607 1258.647687 0.002487
As one can see, the average case is not really impacted. However, the worth case
we get after this changeset are much better than the one we had before it. We
have 30 pairs where improvements are above 10 minutes.
This reflect in the combined time for all pairs
before: 26256s
after: 1300s (-95%)
If we remove these pathological 30 cases, we still see a significant improvements:
before: 1631s
after: 1245s (-24%)
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Thu, 10 Oct 2019 03:49:33 +0200 |
parents | 40f78072fda9 |
children | 6cc269bd1c29 |
line wrap: on
line source
#testcases flat tree #testcases lfs-on lfs-off $ cat >> $HGRCPATH << EOF > [experimental] > evolution=createmarkers > EOF #if lfs-on $ cat >> $HGRCPATH <<EOF > [extensions] > lfs = > EOF #endif $ . "$TESTDIR/narrow-library.sh" #if tree $ cat << EOF >> $HGRCPATH > [experimental] > treemanifest = 1 > EOF #endif $ hg init master $ cd master $ cat >> .hg/hgrc <<EOF > [narrow] > serveellipses=True > EOF $ 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 $ hg log -T "{rev}: {desc}\n" 10: add d10/f 9: add d9/f 8: add d8/f 7: add d7/f 6: add d6/f 5: add d5/f 4: add d4/f 3: add d3/f 2: add d2/f 1: add d1/f 0: add d0/f $ cd .. Error if '.' or '..' are in the directory to track. $ hg clone --narrow ssh://user@dummy/master foo --include ./asdf abort: "." and ".." are not allowed in narrowspec paths [255] $ hg clone --narrow ssh://user@dummy/master foo --include asdf/.. abort: "." and ".." are not allowed in narrowspec paths [255] $ hg clone --narrow ssh://user@dummy/master foo --include a/./c abort: "." and ".." are not allowed in narrowspec paths [255] Names with '.' in them are OK. $ hg clone --narrow ssh://user@dummy/master should-work --include a/.b/c requesting all changes adding changesets adding manifests adding file changes added 1 changesets with 0 changes to 0 files new changesets * (glob) updating to branch default 0 files updated, 0 files merged, 0 files removed, 0 files unresolved Test repo with local changes $ hg clone --narrow ssh://user@dummy/master narrow-local-changes --include d0 --include d3 --include d6 requesting all changes adding changesets adding manifests adding file changes added 6 changesets with 3 changes to 3 files new changesets *:* (glob) updating to branch default 3 files updated, 0 files merged, 0 files removed, 0 files unresolved $ cd narrow-local-changes $ echo local change >> d0/f $ hg ci -m 'local change to d0' $ hg co '.^' 1 files updated, 0 files merged, 0 files removed, 0 files unresolved $ echo local change >> d3/f $ hg ci -m 'local hidden change to d3' created new head $ hg ci --amend -m 'local change to d3' $ hg tracked --removeinclude d0 comparing with ssh://user@dummy/master searching for changes looking for local changes to affected paths The following changeset(s) or their ancestors have local changes not on the remote: * (glob) abort: local changes found (use --force-delete-local-changes to ignore) [255] Check that nothing was removed by the failed attempts $ hg tracked I path:d0 I path:d3 I path:d6 $ hg files d0/f d3/f d6/f $ find * d0 d0/f d3 d3/f d6 d6/f $ hg verify -q Force deletion of local changes $ hg log -T "{rev}: {desc} {outsidenarrow}\n" 8: local change to d3 6: local change to d0 5: add d10/f outsidenarrow 4: add d6/f 3: add d5/f outsidenarrow 2: add d3/f 1: add d2/f outsidenarrow 0: add d0/f $ hg tracked --removeinclude d0 --force-delete-local-changes comparing with ssh://user@dummy/master searching for changes looking for local changes to affected paths The following changeset(s) or their ancestors have local changes not on the remote: * (glob) saved backup bundle to $TESTTMP/narrow-local-changes/.hg/strip-backup/*-narrow.hg (glob) deleting data/d0/f.i (reporevlogstore !) deleting meta/d0/00manifest.i (tree !) deleting data/d0/f/362fef284ce2ca02aecc8de6d5e8a1c3af0556fe (reposimplestore !) deleting data/d0/f/4374b5650fc5ae54ac857c0f0381971fdde376f7 (reposimplestore !) deleting data/d0/f/index (reposimplestore !) $ hg log -T "{rev}: {desc} {outsidenarrow}\n" 7: local change to d3 5: add d10/f outsidenarrow 4: add d6/f 3: add d5/f outsidenarrow 2: add d3/f 1: add d2/f outsidenarrow 0: add d0/f outsidenarrow Can restore stripped local changes after widening $ hg tracked --addinclude d0 -q $ hg unbundle .hg/strip-backup/*-narrow.hg -q $ hg --hidden co -r 'desc("local change to d0")' -q $ cat d0/f 0 local change Pruned commits affecting removed paths should not prevent narrowing $ hg co '.^' 1 files updated, 0 files merged, 0 files removed, 0 files unresolved $ hg debugobsolete `hg log -T '{node}' -r 'desc("local change to d0")'` 1 new obsolescence markers obsoleted 1 changesets $ hg tracked --removeinclude d0 comparing with ssh://user@dummy/master searching for changes looking for local changes to affected paths saved backup bundle to $TESTTMP/narrow-local-changes/.hg/strip-backup/*-narrow.hg (glob) deleting data/d0/f.i (reporevlogstore !) deleting meta/d0/00manifest.i (tree !) deleting data/d0/f/362fef284ce2ca02aecc8de6d5e8a1c3af0556fe (reposimplestore !) deleting data/d0/f/4374b5650fc5ae54ac857c0f0381971fdde376f7 (reposimplestore !) deleting data/d0/f/index (reposimplestore !) Updates off of stripped commit if necessary $ hg co -r 'desc("local change to d3")' -q $ echo local change >> d6/f $ hg ci -m 'local change to d6' $ hg tracked --removeinclude d3 --force-delete-local-changes comparing with ssh://user@dummy/master searching for changes looking for local changes to affected paths The following changeset(s) or their ancestors have local changes not on the remote: * (glob) * (glob) 2 files updated, 0 files merged, 0 files removed, 0 files unresolved saved backup bundle to $TESTTMP/narrow-local-changes/.hg/strip-backup/*-narrow.hg (glob) deleting data/d3/f.i (reporevlogstore !) deleting meta/d3/00manifest.i (tree !) deleting data/d3/f/2661d26c649684b482d10f91960cc3db683c38b4 (reposimplestore !) deleting data/d3/f/99fa7136105a15e2045ce3d9152e4837c5349e4d (reposimplestore !) deleting data/d3/f/index (reposimplestore !) $ hg log -T '{desc}\n' -r . add d10/f Updates to nullid if necessary $ hg tracked --addinclude d3 -q $ hg co null -q $ mkdir d3 $ echo local change > d3/f $ hg add d3/f $ hg ci -m 'local change to d3' created new head $ hg tracked --removeinclude d3 --force-delete-local-changes comparing with ssh://user@dummy/master searching for changes looking for local changes to affected paths The following changeset(s) or their ancestors have local changes not on the remote: * (glob) 0 files updated, 0 files merged, 1 files removed, 0 files unresolved saved backup bundle to $TESTTMP/narrow-local-changes/.hg/strip-backup/*-narrow.hg (glob) deleting data/d3/f.i (reporevlogstore !) deleting meta/d3/00manifest.i (tree !) deleting data/d3/f/2661d26c649684b482d10f91960cc3db683c38b4 (reposimplestore !) deleting data/d3/f/5ce0767945cbdbca3b924bb9fbf5143f72ab40ac (reposimplestore !) deleting data/d3/f/index (reposimplestore !) $ hg id 000000000000 $ cd .. Narrowing doesn't resurrect old commits (unlike what regular `hg strip` does) $ hg clone --narrow ssh://user@dummy/master narrow-obsmarkers --include d0 --include d3 -q $ cd narrow-obsmarkers $ echo a >> d0/f2 $ hg add d0/f2 $ hg ci -m 'modify d0/' $ echo a >> d3/f2 $ hg add d3/f2 $ hg commit --amend -m 'modify d0/ and d3/' $ hg log -T "{rev}: {desc}\n" 5: modify d0/ and d3/ 3: add d10/f 2: add d3/f 1: add d2/f 0: add d0/f $ hg tracked --removeinclude d3 --force-delete-local-changes -q $ hg log -T "{rev}: {desc}\n" 3: add d10/f 2: add d3/f 1: add d2/f 0: add d0/f $ cd .. Widening doesn't lose bookmarks $ hg clone --narrow ssh://user@dummy/master widen-bookmarks --include d0 -q $ cd widen-bookmarks $ hg bookmark my-bookmark $ hg log -T "{rev}: {desc} {bookmarks}\n" 1: add d10/f my-bookmark 0: add d0/f $ hg tracked --addinclude d3 -q $ hg log -T "{rev}: {desc} {bookmarks}\n" 3: add d10/f my-bookmark 2: add d3/f 1: add d2/f 0: add d0/f $ cd .. Can remove last include, making repo empty $ hg clone --narrow ssh://user@dummy/master narrow-empty --include d0 -r 5 adding changesets adding manifests adding file changes added 2 changesets with 1 changes to 1 files new changesets *:* (glob) updating to branch default 1 files updated, 0 files merged, 0 files removed, 0 files unresolved $ cd narrow-empty $ hg tracked --removeinclude d0 comparing with ssh://user@dummy/master searching for changes looking for local changes to affected paths deleting data/d0/f.i (reporevlogstore !) deleting meta/d0/00manifest.i (tree !) deleting data/d0/f/362fef284ce2ca02aecc8de6d5e8a1c3af0556fe (reposimplestore !) deleting data/d0/f/index (reposimplestore !) $ hg tracked $ hg files [1] $ test -d d0 [1] Do some work in the empty clone $ hg diff --change . $ hg branch foo marked working directory as branch foo (branches are permanent and global, did you want a bookmark?) $ hg ci -m empty $ hg log -T "{rev}: {desc} {outsidenarrow}\n" 2: empty 1: add d5/f outsidenarrow 0: add d0/f outsidenarrow $ hg pull -q Can widen the empty clone $ hg tracked --addinclude d0 comparing with ssh://user@dummy/master searching for changes saved backup bundle to $TESTTMP/narrow-empty/.hg/strip-backup/*-widen.hg (glob) adding changesets adding manifests adding file changes added 3 changesets with 1 changes to 1 files $ hg tracked I path:d0 $ hg files d0/f $ find * d0 d0/f $ cd .. TODO(martinvonz): test including e.g. d3/g and then removing it once https://bitbucket.org/Google/narrowhg/issues/6 is fixed $ hg clone --narrow ssh://user@dummy/master narrow --include d0 --include d3 --include d6 --include d9 requesting all changes adding changesets adding manifests adding file changes added 8 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 $ hg tracked I path:d0 I path:d3 I path:d6 I path:d9 $ hg tracked --removeinclude d6 comparing with ssh://user@dummy/master searching for changes looking for local changes to affected paths deleting data/d6/f.i (reporevlogstore !) deleting meta/d6/00manifest.i (tree !) deleting data/d6/f/7339d30678f451ac8c3f38753beeb4cf2e1655c7 (reposimplestore !) deleting data/d6/f/index (reposimplestore !) $ hg tracked I path:d0 I path:d3 I path:d9 #if repofncache $ hg debugrebuildfncache fncache already up to date #endif $ find * d0 d0/f d3 d3/f d9 d9/f $ hg verify -q $ hg tracked --addexclude d3/f comparing with ssh://user@dummy/master searching for changes looking for local changes to affected paths deleting data/d3/f.i (reporevlogstore !) deleting data/d3/f/2661d26c649684b482d10f91960cc3db683c38b4 (reposimplestore !) deleting data/d3/f/index (reposimplestore !) $ hg tracked I path:d0 I path:d3 I path:d9 X path:d3/f #if repofncache $ hg debugrebuildfncache fncache already up to date #endif $ find * d0 d0/f d9 d9/f $ hg verify -q $ hg tracked --addexclude d0 comparing with ssh://user@dummy/master searching for changes looking for local changes to affected paths deleting data/d0/f.i (reporevlogstore !) deleting meta/d0/00manifest.i (tree !) deleting data/d0/f/362fef284ce2ca02aecc8de6d5e8a1c3af0556fe (reposimplestore !) deleting data/d0/f/index (reposimplestore !) $ hg tracked I path:d3 I path:d9 X path:d0 X path:d3/f #if repofncache $ hg debugrebuildfncache fncache already up to date #endif $ find * d9 d9/f Make a 15 of changes to d9 to test the path without --verbose (Note: using regexes instead of "* (glob)" because if the test fails, it produces more sensible diffs) $ hg tracked I path:d3 I path:d9 X path:d0 X path:d3/f $ for x in `$TESTDIR/seq.py 1 15` > do > echo local change >> d9/f > hg commit -m "change $x to d9/f" > done $ hg tracked --removeinclude d9 comparing with ssh://user@dummy/master searching for changes looking for local changes to affected paths The following changeset(s) or their ancestors have local changes not on the remote: ^[0-9a-f]{12}$ (re) ^[0-9a-f]{12}$ (re) ^[0-9a-f]{12}$ (re) ^[0-9a-f]{12}$ (re) ^[0-9a-f]{12}$ (re) ^[0-9a-f]{12}$ (re) ^[0-9a-f]{12}$ (re) ^[0-9a-f]{12}$ (re) ^[0-9a-f]{12}$ (re) ^[0-9a-f]{12}$ (re) ...and 5 more, use --verbose to list all abort: local changes found (use --force-delete-local-changes to ignore) [255] Now test it *with* verbose. $ hg tracked --removeinclude d9 --verbose comparing with ssh://user@dummy/master searching for changes looking for local changes to affected paths The following changeset(s) or their ancestors have local changes not on the remote: ^[0-9a-f]{12}$ (re) ^[0-9a-f]{12}$ (re) ^[0-9a-f]{12}$ (re) ^[0-9a-f]{12}$ (re) ^[0-9a-f]{12}$ (re) ^[0-9a-f]{12}$ (re) ^[0-9a-f]{12}$ (re) ^[0-9a-f]{12}$ (re) ^[0-9a-f]{12}$ (re) ^[0-9a-f]{12}$ (re) ^[0-9a-f]{12}$ (re) ^[0-9a-f]{12}$ (re) ^[0-9a-f]{12}$ (re) ^[0-9a-f]{12}$ (re) ^[0-9a-f]{12}$ (re) abort: local changes found (use --force-delete-local-changes to ignore) [255] $ cd .. Test --auto-remove-includes $ hg clone --narrow ssh://user@dummy/master narrow-auto-remove -q \ > --include d0 --include d1 --include d2 $ cd narrow-auto-remove $ echo a >> d0/f $ hg ci -m 'local change to d0' $ hg co '.^' 1 files updated, 0 files merged, 0 files removed, 0 files unresolved $ echo a >> d1/f $ hg ci -m 'local change to d1' created new head $ hg debugobsolete $(hg log -T '{node}' -r 'desc("local change to d0")') 1 new obsolescence markers obsoleted 1 changesets $ echo n | hg tracked --auto-remove-includes --config ui.interactive=yes comparing with ssh://user@dummy/master searching for changes looking for unused includes to remove path:d0 path:d2 remove these unused includes (yn)? n $ hg tracked --auto-remove-includes comparing with ssh://user@dummy/master searching for changes looking for unused includes to remove path:d0 path:d2 remove these unused includes (yn)? y looking for local changes to affected paths saved backup bundle to $TESTTMP/narrow-auto-remove/.hg/strip-backup/*-narrow.hg (glob) deleting data/d0/f.i deleting data/d2/f.i deleting meta/d0/00manifest.i (tree !) deleting meta/d2/00manifest.i (tree !) $ hg tracked I path:d1 $ hg files d1/f $ hg tracked --auto-remove-includes comparing with ssh://user@dummy/master searching for changes looking for unused includes to remove found no unused includes