diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py --- a/mercurial/localrepo.py +++ b/mercurial/localrepo.py @@ -1951,8 +1951,8 @@ class localrepository(object): if not r: self.ui.warn(_('updating %s to public failed!\n') % newremotehead) - if ('obsolete' in remote.listkeys('namespaces') - and self.obsstore): + if (self.obsstore and + 'obsolete' in remote.listkeys('namespaces')): data = self.listkeys('obsolete')['dump'] r = remote.pushkey('obsolete', 'dump', '', data) if not r: diff --git a/tests/test-hook.t b/tests/test-hook.t --- a/tests/test-hook.t +++ b/tests/test-hook.t @@ -214,7 +214,6 @@ test that prepushkey can prevent incomin searching for changes no changes found listkeys hook: HG_NAMESPACE=phases HG_VALUES={'cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b': '1', 'publishing': 'True'} - listkeys hook: HG_NAMESPACE=namespaces HG_VALUES={'bookmarks': '', 'namespaces': '', 'obsolete': '', 'phases': ''} listkeys hook: HG_NAMESPACE=bookmarks HG_VALUES={'bar': '0000000000000000000000000000000000000000', 'foo': '0000000000000000000000000000000000000000'} listkeys hook: HG_NAMESPACE=bookmarks HG_VALUES={'bar': '0000000000000000000000000000000000000000', 'foo': '0000000000000000000000000000000000000000'} exporting bookmark baz diff --git a/tests/test-obsolete.t b/tests/test-obsolete.t --- a/tests/test-obsolete.t +++ b/tests/test-obsolete.t @@ -14,6 +14,16 @@ > hg id --debug -ir "desc('$1')" > } + $ cat > debugkeys.py < def reposetup(ui, repo): + > class debugkeysrepo(repo.__class__): + > def listkeys(self, namespace): + > ui.write('listkeys %s\n' % (namespace,)) + > return super(debugkeysrepo, self).listkeys(namespace) + > + > if repo.local(): + > repo.__class__ = debugkeysrepo + > EOF $ hg init tmpa $ cd tmpa @@ -178,6 +188,16 @@ Try to pull markers ca819180edb99ed25ceafb3e9584ac287e240b00 1337133713371337133713371337133713371337 0 {'date': '1338 0', 'user': 'test'} 1337133713371337133713371337133713371337 5601fb93a350734d935195fee37f4054c529ff39 0 {'date': '1339 0', 'user': 'test'} +Check obsolete keys are exchanged only if source has an obsolete store + + $ hg init empty + $ hg --config extensions.debugkeys=debugkeys.py -R empty push tmpd + pushing to tmpd + no changes found + listkeys phases + listkeys bookmarks + [1] + clone support (markers are copied and extinct changesets are included to allow hardlinks)