pushkey: do not exchange obsole markers if feature is disabled stable
authorPierre-Yves David <pierre-yves.david@ens-lyon.org>
Sat, 28 Jul 2012 13:33:06 +0200
branchstable
changeset 17298 59c14bf5a48c
parent 17297 6955d69a52a4
child 17299 e51d4aedace9
pushkey: do not exchange obsole markers if feature is disabled This apply to both push and pull both when client or server.
mercurial/localrepo.py
mercurial/obsolete.py
mercurial/pushkey.py
tests/test-bookmarks-pushpull.t
tests/test-hook.t
tests/test-http-proxy.t
tests/test-https.t
tests/test-ssh.t
--- a/mercurial/localrepo.py	Sat Jul 28 13:05:25 2012 +0200
+++ b/mercurial/localrepo.py	Sat Jul 28 13:33:06 2012 +0200
@@ -1787,15 +1787,16 @@
                 # should be seen as public
                 phases.advanceboundary(self, phases.public, subset)
 
-            self.ui.debug('fetching remote obsolete markers')
-            remoteobs = remote.listkeys('obsolete')
-            if 'dump0' in remoteobs:
-                if tr is None:
-                    tr = self.transaction(trname)
-                for key in sorted(remoteobs, reverse=True):
-                    if key.startswith('dump'):
-                        data = base85.b85decode(remoteobs[key])
-                        self.obsstore.mergemarkers(tr, data)
+            if obsolete._enabled:
+                self.ui.debug('fetching remote obsolete markers')
+                remoteobs = remote.listkeys('obsolete')
+                if 'dump0' in remoteobs:
+                    if tr is None:
+                        tr = self.transaction(trname)
+                    for key in sorted(remoteobs, reverse=True):
+                        if key.startswith('dump'):
+                            data = base85.b85decode(remoteobs[key])
+                            self.obsstore.mergemarkers(tr, data)
             if tr is not None:
                 tr.close()
         finally:
@@ -1959,7 +1960,7 @@
                             self.ui.warn(_('updating %s to public failed!\n')
                                             % newremotehead)
                 self.ui.debug('try to push obsolete markers to remote\n')
-                if (self.obsstore and
+                if (obsolete._enabled and self.obsstore and
                     'obsolete' in remote.listkeys('namespaces')):
                     rslts = []
                     remotedata = self.listkeys('obsolete')
--- a/mercurial/obsolete.py	Sat Jul 28 13:05:25 2012 +0200
+++ b/mercurial/obsolete.py	Sat Jul 28 13:33:06 2012 +0200
@@ -55,6 +55,10 @@
 from mercurial import util, base85
 from i18n import _
 
+# the obsolete feature is not mature enought to be enabled by default.
+# you have to rely on third party extension extension to enable this.
+_enabled = False
+
 _pack = struct.pack
 _unpack = struct.unpack
 
--- a/mercurial/pushkey.py	Sat Jul 28 13:05:25 2012 +0200
+++ b/mercurial/pushkey.py	Sat Jul 28 13:33:06 2012 +0200
@@ -11,6 +11,8 @@
     n = {}
     for k in _namespaces:
         n[k] = ""
+    if not obsolete._enabled:
+        n.pop('obsolete')
     return n
 
 _namespaces = {"namespaces": (lambda *x: False, _nslist),
--- a/tests/test-bookmarks-pushpull.t	Sat Jul 28 13:05:25 2012 +0200
+++ b/tests/test-bookmarks-pushpull.t	Sat Jul 28 13:33:06 2012 +0200
@@ -40,7 +40,6 @@
   bookmarks	
   phases	
   namespaces	
-  obsolete	
   $ hg debugpushkey ../a bookmarks
   Y	4e3505fd95835d721066b76e75dbb8cc554d7f77
   X	4e3505fd95835d721066b76e75dbb8cc554d7f77
@@ -215,7 +214,6 @@
   bookmarks	
   phases	
   namespaces	
-  obsolete	
   $ hg debugpushkey http://localhost:$HGPORT/ bookmarks
   Y	4efff6d98829d9c824c621afd6e3f01865f5439f
   foobar	9b140be1080824d768c5a4691a564088eede71f9
--- a/tests/test-hook.t	Sat Jul 28 13:05:25 2012 +0200
+++ b/tests/test-hook.t	Sat Jul 28 13:33:06 2012 +0200
@@ -198,7 +198,6 @@
   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=obsolete HG_VALUES={}
   listkeys hook: HG_NAMESPACE=bookmarks HG_VALUES={'bar': '0000000000000000000000000000000000000000', 'foo': '0000000000000000000000000000000000000000'}
   adding remote bookmark bar
   importing bookmark bar
--- a/tests/test-http-proxy.t	Sat Jul 28 13:05:25 2012 +0200
+++ b/tests/test-http-proxy.t	Sat Jul 28 13:33:06 2012 +0200
@@ -105,24 +105,20 @@
   * - - [*] "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=obsolete (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=obsolete (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=obsolete (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=obsolete (glob)
   * - - [*] "GET http://localhost:$HGPORT/?cmd=listkeys HTTP/1.1" - - x-hgarg-1:namespace=bookmarks (glob)
 
--- a/tests/test-https.t	Sat Jul 28 13:05:25 2012 +0200
+++ b/tests/test-https.t	Sat Jul 28 13:33:06 2012 +0200
@@ -125,7 +125,6 @@
   adding file changes
   added 1 changesets with 4 changes to 4 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)
-  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)
   updating to branch default
   4 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ hg verify -R copy-pull
@@ -155,7 +154,6 @@
   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 ..
 
@@ -184,7 +182,6 @@
   pulling from https://localhost:$HGPORT/
   searching for changes
   no changes found
-  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)
 
 cacert mismatch
 
@@ -197,7 +194,6 @@
   pulling from https://127.0.0.1:$HGPORT/
   searching for changes
   no changes found
-  warning: 127.0.0.1 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)
   $ hg -R copy-pull pull --config web.cacerts=pub-other.pem
   abort: error: *:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed (glob)
   [255]
@@ -206,7 +202,6 @@
   pulling from https://localhost:$HGPORT/
   searching for changes
   no changes found
-  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)
 
 Test server cert which isn't valid yet
 
@@ -264,7 +259,6 @@
   pulling from https://localhost:$HGPORT/
   searching for changes
   no changes found
-  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)
 
 Test https with cacert and fingerprint through proxy
 
--- a/tests/test-ssh.t	Sat Jul 28 13:05:25 2012 +0200
+++ b/tests/test-ssh.t	Sat Jul 28 13:33:06 2012 +0200
@@ -167,7 +167,6 @@
   bookmarks	
   phases	
   namespaces	
-  obsolete	
   $ hg book foo -r 0
   $ hg out -B
   comparing with ssh://user@dummy/remote