pushkey: expose "publicphases" namespace draft
authorGregory Szorc <gregory.szorc@gmail.com>
Mon, 15 Feb 2016 17:54:43 -0800
changeset 31541 383bd7ea93ebcbd08ca709b5330d57c194b03881
parent 31540 85661cc4da704cbc770d61dc297e9cd0844c5c77
child 31542 285986437ae0c1a0356073102ad611a2404e5906
push id231
push usergszorc@mozilla.com
push dateThu, 26 May 2016 03:04:27 +0000
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.
mercurial/pushkey.py
tests/test-bookmarks-pushpull.t
tests/test-ssh-bundle1.t
tests/test-ssh.t
--- 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: {}))
--- 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
@@ -472,16 +473,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/
--- 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
--- 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