##// END OF EJS Templates
cmdutil: build "%m" (desc|firstline) in makefilename()
Yuya Nishihara -
r36225:cc46e68f default
parent child Browse files
Show More
@@ -891,13 +891,14 b' def getcommiteditor(edit=False, finishde'
891 891 else:
892 892 return commiteditor
893 893
894 def makefilename(ctx, pat, desc=None,
894 def makefilename(ctx, pat,
895 895 total=None, seqno=None, revwidth=None, pathname=None):
896 896 expander = {
897 897 'H': lambda: ctx.hex(),
898 898 'R': lambda: '%d' % ctx.rev(),
899 899 'h': lambda: short(ctx.node()),
900 'm': lambda: re.sub('[^\w]', '_', desc or ''),
900 'm': lambda: re.sub('[^\w]', '_',
901 ctx.description().rstrip().splitlines()[0]),
901 902 'r': lambda: ('%d' % ctx.rev()).zfill(revwidth or 0),
902 903 '%': lambda: '%',
903 904 'b': lambda: os.path.basename(ctx.repo().root),
@@ -954,7 +955,7 b' class _unclosablefile(object):'
954 955 def __exit__(self, exc_type, exc_value, exc_tb):
955 956 pass
956 957
957 def makefileobj(ctx, pat, desc=None, total=None,
958 def makefileobj(ctx, pat, total=None,
958 959 seqno=None, revwidth=None, mode='wb', modemap=None,
959 960 pathname=None):
960 961
@@ -967,7 +968,7 b' def makefileobj(ctx, pat, desc=None, tot'
967 968 else:
968 969 fp = repo.ui.fin
969 970 return _unclosablefile(fp)
970 fn = makefilename(ctx, pat, desc, total, seqno, revwidth, pathname)
971 fn = makefilename(ctx, pat, total, seqno, revwidth, pathname)
971 972 if modemap is not None:
972 973 mode = modemap.get(fn, mode)
973 974 if mode == 'wb':
@@ -1542,9 +1543,7 b" def export(repo, revs, fntemplate='hg-%h"
1542 1543 ctx = repo[rev]
1543 1544 fo = None
1544 1545 if not fp and fntemplate:
1545 desc_lines = ctx.description().rstrip().split('\n')
1546 desc = desc_lines[0] #Commit always has a first line.
1547 fo = makefileobj(ctx, fntemplate, desc=desc,
1546 fo = makefileobj(ctx, fntemplate,
1548 1547 total=total, seqno=seqno, revwidth=revwidth,
1549 1548 mode='wb', modemap=filemode)
1550 1549 dest = fo.name
General Comments 0
You need to be logged in to leave comments. Login now