getbundle: add `obsmarkers` argument to getbundle
authorPierre-Yves David <pierre-yves.david@fb.com>
Fri, 29 Aug 2014 12:36:17 +0200
changeset 22353 47e3420ae889
parent 22352 dc371d1f0de1
child 22354 a89add6c6b2f
getbundle: add `obsmarkers` argument to getbundle This argument triggers the retrieval of all markers relevant to the set of changesets defined by the nodes in `heads`.
mercurial/exchange.py
mercurial/wireproto.py
--- a/mercurial/exchange.py	Fri Aug 29 12:28:58 2014 +0200
+++ b/mercurial/exchange.py	Fri Aug 29 12:36:17 2014 +0200
@@ -999,10 +999,21 @@
         part.addparam('namespace', namespace)
         keys = repo.listkeys(namespace).items()
         part.data = pushkey.encodekeys(keys)
+    _getbundleobsmarkerpart(bundler, repo, source, heads=heads, common=common,
+                            bundlecaps=bundlecaps, **kwargs)
     _getbundleextrapart(bundler, repo, source, heads=heads, common=common,
                         bundlecaps=bundlecaps, **kwargs)
     return util.chunkbuffer(bundler.getchunks())
 
+def _getbundleobsmarkerpart(bundler, repo, source, heads=None, common=None,
+                            bundlecaps=None, **kwargs):
+    if kwargs.get('obsmarkers', False):
+        if heads is None:
+            heads = repo.heads()
+        subset = [c.node() for c in repo.set('::%ln', heads)]
+        markers = repo.obsstore.relevantmarkers(subset)
+        buildobsmarkerspart(bundler, markers)
+
 def _getbundleextrapart(bundler, repo, source, heads=None, common=None,
                         bundlecaps=None, **kwargs):
     """hook function to let extensions add parts to the requested bundle"""
--- a/mercurial/wireproto.py	Fri Aug 29 12:28:58 2014 +0200
+++ b/mercurial/wireproto.py	Fri Aug 29 12:36:17 2014 +0200
@@ -202,6 +202,7 @@
 # :plain: string with no transformation needed.
 gboptsmap = {'heads':  'nodes',
              'common': 'nodes',
+             'obsmarkers': 'boolean',
              'bundlecaps': 'csv',
              'listkeys': 'csv',
              'cg': 'boolean'}