[PATCH 1 of 2] Add branch information to hg export

hopper at omnifarious.org hopper at omnifarious.org
Thu May 10 21:29:43 UTC 2007


# HG changeset patch
# User Eric Hopper <hopper at omnifarious.org>
# Date 1178829756 25200
# Node ID f60b0da1dec163b0bf563726f914ce5f5648aa4a
# Parent  ba22e867cb23fb11f83c37705743e050afd66a6a
Add branch information to hg export.

diff --git a/mercurial/patch.py b/mercurial/patch.py
--- a/mercurial/patch.py
+++ b/mercurial/patch.py
@@ -607,6 +607,7 @@ def export(repo, revs, template='hg-%h.p
         ctx = repo.changectx(rev)
         node = ctx.node()
         parents = [p.node() for p in ctx.parents() if p]
+        branch = ctx.branch()
         if switch_parent:
             parents.reverse()
         prev = (parents and parents[0]) or nullid
@@ -620,6 +621,8 @@ def export(repo, revs, template='hg-%h.p
         fp.write("# HG changeset patch\n")
         fp.write("# User %s\n" % ctx.user())
         fp.write("# Date %d %d\n" % ctx.date())
+        if branch and (branch != 'default'):
+            fp.write("# Branch %s\n" % branch)
         fp.write("# Node ID %s\n" % hex(node))
         fp.write("# Parent  %s\n" % hex(prev))
         if len(parents) > 1:

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.mercurial-scm.org/pipermail/mercurial/attachments/20070510/c2f60943/attachment-0001.asc>


More information about the Mercurial mailing list