[PATCH 3 of 5 RFC] pushkey: expose "publicphases" namespace
Gregory Szorc
gregory.szorc at gmail.com
Mon Feb 15 21:03:34 EST 2016
# HG changeset patch
# User Gregory Szorc <gregory.szorc at gmail.com>
# Date 1455587683 28800
# Mon Feb 15 17:54:43 2016 -0800
# Node ID 3d322b59249c3ce7588691495684e9c554023119
# Parent 52961d59851f8455f31ca996134870b94e6ea8a0
pushkey: expose "publicphases" namespace
In order to improve the discovery mechanism for phases for mega-headed
repositories, we wish to expose public phase heads as opposed to draft
phase roots.
We enable this by introducing a new "publicphases" namespace.
We can't easily re-use the "phases" namespace because the "listkeys"
wire protocol command doesn't currently take any arguments (other than
the phase name) and introducing an argument that is unique to a single
namespace feels wrong.
The new namespace is read only.
diff --git a/mercurial/pushkey.py b/mercurial/pushkey.py
--- a/mercurial/pushkey.py
+++ b/mercurial/pushkey.py
@@ -20,16 +20,17 @@ def _nslist(repo):
n[k] = ""
if not obsolete.isenabled(repo, obsolete.exchangeopt):
n.pop('obsolete')
return n
_namespaces = {"namespaces": (lambda *x: False, _nslist),
"bookmarks": (bookmarks.pushbookmark, bookmarks.listbookmarks),
"phases": (phases.pushphase, phases.listphases),
+ "publicphases": (lambda *x: 0, phases.listpublicphases),
"obsolete": (obsolete.pushmarker, obsolete.listmarkers),
}
def register(namespace, pushkey, listkeys):
_namespaces[namespace] = (pushkey, listkeys)
def _get(namespace):
return _namespaces.get(namespace, (lambda *x: False, lambda *x: {}))
diff --git a/tests/test-bookmarks-pushpull.t b/tests/test-bookmarks-pushpull.t
--- a/tests/test-bookmarks-pushpull.t
+++ b/tests/test-bookmarks-pushpull.t
@@ -48,16 +48,17 @@ import bookmark by name
X 0:4e3505fd9583
* Y 0:4e3505fd9583
Z 0:4e3505fd9583
$ hg debugpushkey ../a namespaces
bookmarks
namespaces
obsolete
phases
+ publicphases
$ hg debugpushkey ../a bookmarks
X 4e3505fd95835d721066b76e75dbb8cc554d7f77
Y 4e3505fd95835d721066b76e75dbb8cc554d7f77
Z 4e3505fd95835d721066b76e75dbb8cc554d7f77
delete the bookmark to re-pull it
$ hg book -d X
@@ -449,16 +450,17 @@ hgweb
$ cat ../hg.pid >> $DAEMON_PIDS
$ cd ../a
$ hg debugpushkey http://localhost:$HGPORT/ namespaces
bookmarks
namespaces
obsolete
phases
+ publicphases
$ hg debugpushkey http://localhost:$HGPORT/ bookmarks
@ 9b140be1080824d768c5a4691a564088eede71f9
X 9b140be1080824d768c5a4691a564088eede71f9
Y c922c0139ca03858f655e4a2af4dd02796a63969
Z 9b140be1080824d768c5a4691a564088eede71f9
foo 0000000000000000000000000000000000000000
foobar 9b140be1080824d768c5a4691a564088eede71f9
$ hg out -B http://localhost:$HGPORT/
diff --git a/tests/test-ssh-bundle1.t b/tests/test-ssh-bundle1.t
--- a/tests/test-ssh-bundle1.t
+++ b/tests/test-ssh-bundle1.t
@@ -219,16 +219,17 @@ check remote tip
test pushkeys and bookmarks
$ cd ../local
$ hg debugpushkey --config ui.ssh="python \"$TESTDIR/dummyssh\"" ssh://user@dummy/remote namespaces
bookmarks
namespaces
phases
+ publicphases
$ hg book foo -r 0
$ hg out -B
comparing with ssh://user@dummy/remote
searching for changed bookmarks
foo 1160648e36ce
$ hg push -B foo
pushing to ssh://user@dummy/remote
searching for changes
diff --git a/tests/test-ssh.t b/tests/test-ssh.t
--- a/tests/test-ssh.t
+++ b/tests/test-ssh.t
@@ -213,16 +213,17 @@ check remote tip
test pushkeys and bookmarks
$ cd ../local
$ hg debugpushkey --config ui.ssh="python \"$TESTDIR/dummyssh\"" ssh://user@dummy/remote namespaces
bookmarks
namespaces
phases
+ publicphases
$ hg book foo -r 0
$ hg out -B
comparing with ssh://user@dummy/remote
searching for changed bookmarks
foo 1160648e36ce
$ hg push -B foo
pushing to ssh://user@dummy/remote
searching for changes
More information about the Mercurial-devel
mailing list