changeset 22353:47e3420ae889

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`.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Fri, 29 Aug 2014 12:36:17 +0200
parents dc371d1f0de1
children a89add6c6b2f
files mercurial/exchange.py mercurial/wireproto.py
diffstat 2 files changed, 12 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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'}