##// END OF EJS Templates
export: introduce a generic way to add patch header on export...
Pierre-Yves David -
r26545:e99c3846 default
parent child Browse files
Show More
@@ -991,6 +991,14 b' def tryimportone(ui, repo, hunk, parents'
991 lockmod.release(dsguard)
991 lockmod.release(dsguard)
992 os.unlink(tmpname)
992 os.unlink(tmpname)
993
993
994 # facility to let extensions include additional data in an exported patch
995 # list of identifiers to be executed in order
996 extraexport = []
997 # mapping from identifier to actual export function
998 # function as to return a string to be added to the header or None
999 # it is given two arguments (sequencenumber, changectx)
1000 extraexportmap = {}
1001
994 def export(repo, revs, template='hg-%h.patch', fp=None, switch_parent=False,
1002 def export(repo, revs, template='hg-%h.patch', fp=None, switch_parent=False,
995 opts=None, match=None):
1003 opts=None, match=None):
996 '''export changesets as hg patches.'''
1004 '''export changesets as hg patches.'''
@@ -1040,6 +1048,11 b" def export(repo, revs, template='hg-%h.p"
1040 write("# Parent %s\n" % hex(prev))
1048 write("# Parent %s\n" % hex(prev))
1041 if len(parents) > 1:
1049 if len(parents) > 1:
1042 write("# Parent %s\n" % hex(parents[1]))
1050 write("# Parent %s\n" % hex(parents[1]))
1051
1052 for headerid in extraexport:
1053 header = extraexportmap[headerid](seqno, ctx)
1054 if header is not None:
1055 write('# %s\n' % header)
1043 write(ctx.description().rstrip())
1056 write(ctx.description().rstrip())
1044 write("\n\n")
1057 write("\n\n")
1045
1058
General Comments 0
You need to be logged in to leave comments. Login now