[PATCH 5 of 6 phases exchange V2] phases: exchange phase boundaries on pull
pierre-yves.david at logilab.fr
pierre-yves.david at logilab.fr
Thu Dec 15 05:05:50 CST 2011
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at logilab.fr>
# Date 1323944922 -3600
# Node ID ef72c0f1e19778a47976e7cb4b827d379653ecfd
# Parent dbc6f1e57a431cc47ce3c98dcc04d893a8f4fd57
phases: exchange phase boundaries on pull
Add an extra argument to addchangegroup to all phase code to execute before the
lock is released.
diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -1505,10 +1505,11 @@ class localrepository(repo.repository):
tmp = discovery.findcommonincoming(self, remote, heads=heads,
force=force)
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]:
self.ui.status(_("requesting all changes\n"))
elif heads is None and remote.capable('changegroupsubset'):
@@ -1524,12 +1525,30 @@ class localrepository(repo.repository):
raise util.Abort(_("partial pull cannot be done because "
"other repository doesn't support "
"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()
return result
diff --git a/tests/test-hook.t b/tests/test-hook.t
--- a/tests/test-hook.t
+++ b/tests/test-hook.t
@@ -190,10 +190,11 @@ listkeys hook
$ cd ../b
$ hg pull -B bar ../a
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
test that prepushkey can prevent incoming keys
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
@@ -103,19 +103,23 @@ do not use the proxy if it is in the no
* - - [*] "GET http://localhost:$HGPORT/?cmd=stream_out HTTP/1.1" - - (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)
* - - [*] "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
@@ -144,12 +144,12 @@ pull without cacert
searching for changes
adding changesets
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 ..
cacert configured in local repo
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
@@ -110,10 +110,13 @@ update must update phase of common chang
0 0 a-A - 054250a37db4
Publish configuration option
----------------------------
+Pull
+````
+
changegroup are added without phase movement
$ hg bundle -a ../base.bundle
5 changesets found
$ cd ..
@@ -135,5 +138,135 @@ changegroup are added without phase move
2 1 b-A - f54f1bb90ff3
1 1 a-B - 548a3d25dbf0
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 ..
More information about the Mercurial-devel
mailing list