Mercurial > hg
changeset 15650:5b26667fc4d3
phases: exchange phase boundaries on pull
Add an extra argument to addchangegroup to all phase code to execute before the
lock is released.
author | Pierre-Yves David <pierre-yves.david@logilab.fr> |
---|---|
date | Thu, 15 Dec 2011 11:28:42 +0100 |
parents | ca7c4254a21a |
children | e69a3cdad37e |
files | mercurial/localrepo.py tests/test-hook.t tests/test-http-proxy.t tests/test-https.t tests/test-phases-exchange.t |
diffstat | 5 files changed, 159 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/localrepo.py Thu Dec 15 02:18:24 2011 +0100 +++ b/mercurial/localrepo.py Thu Dec 15 11:28:42 2011 +0100 @@ -1507,6 +1507,7 @@ common, fetch, rheads = tmp if not fetch: self.ui.status(_("no changes found\n")) + added = [] result = 0 else: if heads is None and list(common) == [nullid]: @@ -1526,8 +1527,26 @@ "changegroupsubset.")) else: cg = remote.changegroupsubset(fetch, heads, 'pull') + clstart = len(self.changelog) result = self.addchangegroup(cg, 'pull', remote.url()) - phases.advanceboundary(self, 0, common) + clend = len(self.changelog) + added = [self.changelog.node(r) for r in xrange(clstart, clend)] + + + # Get remote phases data from remote + remotephases = remote.listkeys('phases') + publishing = bool(remotephases.get('publishing', False)) + if remotephases and not publishing: + # remote is new and unpublishing + subset = common + added + rheads, rroots = phases.analyzeremotephases(self, subset, + remotephases) + for phase, boundary in enumerate(rheads): + phases.advanceboundary(self, phase, boundary) + else: + # Remote is old or publishing all common changesets + # should be seen as public + phases.advanceboundary(self, 0, common + added) finally: lock.release()
--- a/tests/test-hook.t Thu Dec 15 02:18:24 2011 +0100 +++ b/tests/test-hook.t Thu Dec 15 11:28:42 2011 +0100 @@ -192,6 +192,7 @@ pulling from ../a listkeys hook: HG_NAMESPACE=bookmarks HG_VALUES={'bar': '0000000000000000000000000000000000000000', 'foo': '0000000000000000000000000000000000000000'} no changes found + listkeys hook: HG_NAMESPACE=phases HG_VALUES={'cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b': '1', 'publishing': 'True'} listkeys hook: HG_NAMESPACE=bookmarks HG_VALUES={'bar': '0000000000000000000000000000000000000000', 'foo': '0000000000000000000000000000000000000000'} importing bookmark bar $ cd ../a
--- a/tests/test-http-proxy.t Thu Dec 15 02:18:24 2011 +0100 +++ b/tests/test-http-proxy.t Thu Dec 15 11:28:42 2011 +0100 @@ -105,17 +105,21 @@ * - - [*] "GET http://localhost:$HGPORT/?cmd=capabilities HTTP/1.1" - - (glob) * - - [*] "GET http://localhost:$HGPORT/?cmd=batch HTTP/1.1" - - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D (glob) * - - [*] "GET http://localhost:$HGPORT/?cmd=getbundle HTTP/1.1" - - x-hgarg-1:common=0000000000000000000000000000000000000000&heads=83180e7845de420a1bb46896fd5fe05294f8d629 (glob) + * - - [*] "GET http://localhost:$HGPORT/?cmd=listkeys HTTP/1.1" - - x-hgarg-1:namespace=phases (glob) * - - [*] "GET http://localhost:$HGPORT/?cmd=listkeys HTTP/1.1" - - x-hgarg-1:namespace=bookmarks (glob) * - - [*] "GET http://localhost:$HGPORT/?cmd=capabilities HTTP/1.1" - - (glob) * - - [*] "GET http://localhost:$HGPORT/?cmd=batch HTTP/1.1" - - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D (glob) * - - [*] "GET http://localhost:$HGPORT/?cmd=getbundle HTTP/1.1" - - x-hgarg-1:common=0000000000000000000000000000000000000000&heads=83180e7845de420a1bb46896fd5fe05294f8d629 (glob) + * - - [*] "GET http://localhost:$HGPORT/?cmd=listkeys HTTP/1.1" - - x-hgarg-1:namespace=phases (glob) * - - [*] "GET http://localhost:$HGPORT/?cmd=listkeys HTTP/1.1" - - x-hgarg-1:namespace=bookmarks (glob) * - - [*] "GET http://localhost:$HGPORT/?cmd=capabilities HTTP/1.1" - - (glob) * - - [*] "GET http://localhost:$HGPORT/?cmd=batch HTTP/1.1" - - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D (glob) * - - [*] "GET http://localhost:$HGPORT/?cmd=getbundle HTTP/1.1" - - x-hgarg-1:common=0000000000000000000000000000000000000000&heads=83180e7845de420a1bb46896fd5fe05294f8d629 (glob) + * - - [*] "GET http://localhost:$HGPORT/?cmd=listkeys HTTP/1.1" - - x-hgarg-1:namespace=phases (glob) * - - [*] "GET http://localhost:$HGPORT/?cmd=listkeys HTTP/1.1" - - x-hgarg-1:namespace=bookmarks (glob) * - - [*] "GET http://localhost:$HGPORT/?cmd=capabilities HTTP/1.1" - - (glob) * - - [*] "GET http://localhost:$HGPORT/?cmd=batch HTTP/1.1" - - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D (glob) * - - [*] "GET http://localhost:$HGPORT/?cmd=getbundle HTTP/1.1" - - x-hgarg-1:common=0000000000000000000000000000000000000000&heads=83180e7845de420a1bb46896fd5fe05294f8d629 (glob) + * - - [*] "GET http://localhost:$HGPORT/?cmd=listkeys HTTP/1.1" - - x-hgarg-1:namespace=phases (glob) * - - [*] "GET http://localhost:$HGPORT/?cmd=listkeys HTTP/1.1" - - x-hgarg-1:namespace=bookmarks (glob)
--- a/tests/test-https.t Thu Dec 15 02:18:24 2011 +0100 +++ b/tests/test-https.t Thu Dec 15 11:28:42 2011 +0100 @@ -146,8 +146,8 @@ adding manifests adding file changes added 1 changesets with 1 changes to 1 files + warning: localhost certificate with fingerprint 91:4f:1a:ff:87:24:9c:09:b6:85:9b:88:b1:90:6d:30:75:64:91:ca not verified (check hostfingerprints or web.cacerts config setting) changegroup hook: HG_NODE=5fed3813f7f5e1824344fdc9cf8f63bb662c292d HG_SOURCE=pull HG_URL=https://localhost:$HGPORT/ - warning: localhost certificate with fingerprint 91:4f:1a:ff:87:24:9c:09:b6:85:9b:88:b1:90:6d:30:75:64:91:ca not verified (check hostfingerprints or web.cacerts config setting) (run 'hg update' to get a working copy) $ cd ..
--- a/tests/test-phases-exchange.t Thu Dec 15 02:18:24 2011 +0100 +++ b/tests/test-phases-exchange.t Thu Dec 15 11:28:42 2011 +0100 @@ -112,6 +112,9 @@ Publish configuration option ---------------------------- +Pull +```` + changegroup are added without phase movement $ hg bundle -a ../base.bundle @@ -137,3 +140,133 @@ 0 1 a-A - 054250a37db4 $ cd .. +Pulling from publish=False to publish=False does not move boundary. + + $ hg init nu + $ cd nu + $ cat > .hg/hgrc << EOF + > [phases] + > publish=0 + > EOF + $ hg pull ../mu -r 54acac6f23ab + pulling from ../mu + adding changesets + adding manifests + adding file changes + added 3 changesets with 3 changes to 3 files + (run 'hg update' to get a working copy) + $ hgph + 2 1 a-C - 54acac6f23ab + 1 1 a-B - 548a3d25dbf0 + 0 1 a-A - 054250a37db4 + +Even for common + + $ hg pull ../mu -r f54f1bb90ff3 + pulling from ../mu + searching for changes + adding changesets + adding manifests + adding file changes + added 1 changesets with 1 changes to 1 files (+1 heads) + (run 'hg heads' to see heads, 'hg merge' to merge) + $ hgph + 3 1 b-A - f54f1bb90ff3 + 2 1 a-C - 54acac6f23ab + 1 1 a-B - 548a3d25dbf0 + 0 1 a-A - 054250a37db4 + + +Pulling from Publish=True to Publish=False move boundary in common set. +we are in nu + + $ hg pull ../alpha -r b555f63b6063 + pulling from ../alpha + searching for changes + adding changesets + adding manifests + adding file changes + added 1 changesets with 1 changes to 1 files + (run 'hg update' to get a working copy) + $ hgph + 4 0 a-D - b555f63b6063 + 3 0 b-A - f54f1bb90ff3 + 2 0 a-C - 54acac6f23ab + 1 0 a-B - 548a3d25dbf0 + 0 0 a-A - 054250a37db4 + +pulling from Publish=False to publish=False with some public + + $ hg up -q f54f1bb90ff3 + $ mkcommit n-A + $ mkcommit n-B + $ hgph + 6 1 n-B - 145e75495359 + 5 1 n-A - d6bcb4f74035 + 4 0 a-D - b555f63b6063 + 3 0 b-A - f54f1bb90ff3 + 2 0 a-C - 54acac6f23ab + 1 0 a-B - 548a3d25dbf0 + 0 0 a-A - 054250a37db4 + $ cd ../mu + $ hg pull ../nu + pulling from ../nu + searching for changes + adding changesets + adding manifests + adding file changes + added 2 changesets with 2 changes to 2 files + (run 'hg update' to get a working copy) + $ hgph + 6 1 n-B - 145e75495359 + 5 1 n-A - d6bcb4f74035 + 4 0 a-D - b555f63b6063 + 3 0 a-C - 54acac6f23ab + 2 0 b-A - f54f1bb90ff3 + 1 0 a-B - 548a3d25dbf0 + 0 0 a-A - 054250a37db4 + $ cd .. + +pulling into publish=True + + $ cd alpha + $ hgph + 4 0 b-A - f54f1bb90ff3 + 3 0 a-D - b555f63b6063 + 2 0 a-C - 54acac6f23ab + 1 0 a-B - 548a3d25dbf0 + 0 0 a-A - 054250a37db4 + $ hg pull ../mu + pulling from ../mu + searching for changes + adding changesets + adding manifests + adding file changes + added 2 changesets with 2 changes to 2 files + (run 'hg update' to get a working copy) + $ hgph + 6 0 n-B - 145e75495359 + 5 0 n-A - d6bcb4f74035 + 4 0 b-A - f54f1bb90ff3 + 3 0 a-D - b555f63b6063 + 2 0 a-C - 54acac6f23ab + 1 0 a-B - 548a3d25dbf0 + 0 0 a-A - 054250a37db4 + $ cd .. + +pulling back into original repo + + $ cd nu + $ hg pull ../alpha + pulling from ../alpha + searching for changes + no changes found + $ hgph + 6 0 n-B - 145e75495359 + 5 0 n-A - d6bcb4f74035 + 4 0 a-D - b555f63b6063 + 3 0 b-A - f54f1bb90ff3 + 2 0 a-C - 54acac6f23ab + 1 0 a-B - 548a3d25dbf0 + 0 0 a-A - 054250a37db4 + $ cd ..