[PATCH 2 of 2] pushkey: do not advertise `obsolete` namespace unless `use-obsolete=true`

pierre-yves.david at logilab.fr pierre-yves.david at logilab.fr
Wed Jul 4 12:02:03 CDT 2012


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at ens-lyon.org>
# Date 1341416645 -7200
# Node ID 91a363d649605e408b22ee2703e3852937f4c905
# Parent  48e69d968ff26f56eb544ca7c86c19f5fef095de
pushkey: do not advertise `obsolete` namespace unless `use-obsolete=true`

The current exchange code using pushkey is very inefficient. Obsolete markers
propagation should be avoided by default until the obsolete feature is more
mature.

diff --git a/mercurial/pushkey.py b/mercurial/pushkey.py
--- a/mercurial/pushkey.py
+++ b/mercurial/pushkey.py
@@ -9,10 +9,12 @@ import bookmarks, phases, obsolete
 
 def _nslist(repo):
     n = {}
     for k in _namespaces:
         n[k] = ""
+    if not repo._useobsolete():
+        n.pop('obsolete')
     return n
 
 _namespaces = {"namespaces": (lambda *x: False, _nslist),
                "bookmarks": (bookmarks.pushbookmark, bookmarks.listbookmarks),
                "phases": (phases.pushphase, phases.listphases),
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
@@ -38,11 +38,10 @@ import bookmark by name
      Z                         0:4e3505fd9583
   $ hg debugpushkey ../a namespaces
   bookmarks	
   phases	
   namespaces	
-  obsolete	
   $ hg debugpushkey ../a bookmarks
   Y	4e3505fd95835d721066b76e75dbb8cc554d7f77
   X	4e3505fd95835d721066b76e75dbb8cc554d7f77
   Z	4e3505fd95835d721066b76e75dbb8cc554d7f77
   $ hg pull -B X ../a
@@ -213,11 +212,10 @@ hgweb
 
   $ hg debugpushkey http://localhost:$HGPORT/ namespaces 
   bookmarks	
   phases	
   namespaces	
-  obsolete	
   $ hg debugpushkey http://localhost:$HGPORT/ bookmarks
   Y	4efff6d98829d9c824c621afd6e3f01865f5439f
   foobar	9b140be1080824d768c5a4691a564088eede71f9
   Z	0d2164f0ce0d8f1d6f94351eba04b794909be66c
   foo	0000000000000000000000000000000000000000
diff --git a/tests/test-ssh.t b/tests/test-ssh.t
--- a/tests/test-ssh.t
+++ b/tests/test-ssh.t
@@ -165,11 +165,10 @@ test pushkeys and bookmarks
   $ cd ../local
   $ hg debugpushkey --config ui.ssh="python \"$TESTDIR/dummyssh\"" ssh://user@dummy/remote namespaces
   bookmarks	
   phases	
   namespaces	
-  obsolete	
   $ hg book foo -r 0
   $ hg out -B
   comparing with ssh://user@dummy/remote
   searching for changed bookmarks
      foo                       1160648e36ce


More information about the Mercurial-devel mailing list