diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py --- a/mercurial/localrepo.py +++ b/mercurial/localrepo.py @@ -1507,6 +1507,7 @@ class localrepository(repo.repository): 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 @@ class localrepository(repo.repository): "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() diff --git a/tests/test-hook.t b/tests/test-hook.t --- a/tests/test-hook.t +++ b/tests/test-hook.t @@ -192,6 +192,7 @@ listkeys hook 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 diff --git a/tests/test-http-proxy.t b/tests/test-http-proxy.t --- a/tests/test-http-proxy.t +++ b/tests/test-http-proxy.t @@ -105,17 +105,21 @@ do not use the proxy if it is in the no * - - [*] "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) diff --git a/tests/test-https.t b/tests/test-https.t --- a/tests/test-https.t +++ b/tests/test-https.t @@ -146,8 +146,8 @@ pull without cacert 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 .. diff --git a/tests/test-phases-exchange.t b/tests/test-phases-exchange.t --- a/tests/test-phases-exchange.t +++ b/tests/test-phases-exchange.t @@ -112,6 +112,9 @@ update must update phase of common chang Publish configuration option ---------------------------- +Pull +```` + changegroup are added without phase movement $ hg bundle -a ../base.bundle @@ -137,3 +140,133 @@ changegroup are added without phase move 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 ..