hgext/patchbomb.py
changeset 26546 500386e65759
parent 25826 399c8aafc9f9
child 26563 d4a1bfe1de63
--- a/hgext/patchbomb.py	Mon Oct 05 23:17:01 2015 -0700
+++ b/hgext/patchbomb.py	Tue Oct 06 01:49:04 2015 -0700
@@ -73,6 +73,24 @@
 # leave the attribute unspecified.
 testedwith = 'internal'
 
+def _addpullheader(seq, ctx):
+    """Add a header pointing to a public URL where the changeset is available
+    """
+    repo = ctx.repo()
+    # experimental config: patchbomb.publicurl
+    # waiting for some logic that check that the changeset are available on the
+    # destination before patchbombing anything.
+    pullurl = repo.ui.config('patchbomb', 'publicurl')
+    if pullurl is not None:
+        return ('Available At %s\n'
+                '#              hg pull %s -r %s' % (pullurl, pullurl, ctx))
+    return None
+
+def uisetup(ui):
+    cmdutil.extraexport.append('pullurl')
+    cmdutil.extraexportmap['pullurl'] = _addpullheader
+
+
 def prompt(ui, prompt, default=None, rest=':'):
     if default:
         prompt += ' [%s]' % default