diff --git a/hgext/patchbomb.py b/hgext/patchbomb.py index e99c3846d78a0ee7e8abf6841da725513ac38a24_aGdleHQvcGF0Y2hib21iLnB5..500386e65759c665752beb67a98a029f32db1309_aGdleHQvcGF0Y2hib21iLnB5 100644 --- a/hgext/patchbomb.py +++ b/hgext/patchbomb.py @@ -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 diff --git a/tests/test-patchbomb.t b/tests/test-patchbomb.t index e99c3846d78a0ee7e8abf6841da725513ac38a24_dGVzdHMvdGVzdC1wYXRjaGJvbWIudA==..500386e65759c665752beb67a98a029f32db1309_dGVzdHMvdGVzdC1wYXRjaGJvbWIudA== 100644 --- a/tests/test-patchbomb.t +++ b/tests/test-patchbomb.t @@ -2800,3 +2800,18 @@ d +d +Test pull url header +================================= + + $ echo 'intro=auto' >> $HGRCPATH + $ echo 'publicurl=http://example.com/myrepo/' >> $HGRCPATH + $ hg email --date '1980-1-1 0:1' -n -t foo -s test -r '10' | grep '^#' + # HG changeset patch + # User test + # Date 5 0 + # Thu Jan 01 00:00:05 1970 +0000 + # Branch test + # Node ID 3b6f1ec9dde933a40a115a7990f8b320477231af + # Parent 2f9fa9b998c5fe3ac2bd9a2b14bfcbeecbc7c268 + # Available At http://example.com/myrepo/ + # hg pull http://example.com/myrepo/ -r 3b6f1ec9dde9