Show More
@@ -256,8 +256,8 def dodiff(ui, repo, cmdline, pats, opts | |||
|
256 | 256 | cmdutil.export(repo, [repo[node1a].rev(), repo[node2].rev()], |
|
257 | 257 | fntemplate=repo.vfs.reljoin(tmproot, template), |
|
258 | 258 | match=matcher) |
|
259 |
label1a = cmdutil.makefilename(repo, template |
|
|
260 |
label2 = cmdutil.makefilename(repo, template |
|
|
259 | label1a = cmdutil.makefilename(repo[node1a], template) | |
|
260 | label2 = cmdutil.makefilename(repo[node2], template) | |
|
261 | 261 | dir1a = repo.vfs.reljoin(tmproot, label1a) |
|
262 | 262 | dir2 = repo.vfs.reljoin(tmproot, label2) |
|
263 | 263 | dir1b = None |
@@ -265,11 +265,10 def makepatch(ui, repo, rev, patchlines, | |||
|
265 | 265 | if patchtags: |
|
266 | 266 | patchname = patchtags[0] |
|
267 | 267 | elif total > 1: |
|
268 | patchname = cmdutil.makefilename(repo, '%b-%n.patch', | |
|
269 |
|
|
|
270 | total=total) | |
|
268 | patchname = cmdutil.makefilename(repo[node], '%b-%n.patch', | |
|
269 | seqno=idx, total=total) | |
|
271 | 270 | else: |
|
272 |
patchname = cmdutil.makefilename(repo, '%b.patch' |
|
|
271 | patchname = cmdutil.makefilename(repo[node], '%b.patch') | |
|
273 | 272 | disposition = 'inline' |
|
274 | 273 | if opts.get('attach'): |
|
275 | 274 | disposition = 'attachment' |
@@ -891,8 +891,10 def getcommiteditor(edit=False, finishde | |||
|
891 | 891 | else: |
|
892 | 892 | return commiteditor |
|
893 | 893 | |
|
894 |
def makefilename( |
|
|
894 | def makefilename(ctx, pat, desc=None, | |
|
895 | 895 | total=None, seqno=None, revwidth=None, pathname=None): |
|
896 | repo = ctx.repo() | |
|
897 | node = ctx.node() | |
|
896 | 898 | expander = { |
|
897 | 899 | 'H': lambda: hex(node), |
|
898 | 900 | 'R': lambda: '%d' % repo.changelog.rev(node), |
@@ -966,7 +968,8 def makefileobj(repo, pat, node, desc=No | |||
|
966 | 968 | else: |
|
967 | 969 | fp = repo.ui.fin |
|
968 | 970 | return _unclosablefile(fp) |
|
969 | fn = makefilename(repo, pat, node, desc, total, seqno, revwidth, pathname) | |
|
971 | ctx = repo[node] | |
|
972 | fn = makefilename(ctx, pat, desc, total, seqno, revwidth, pathname) | |
|
970 | 973 | if modemap is not None: |
|
971 | 974 | mode = modemap.get(fn, mode) |
|
972 | 975 | if mode == 'wb': |
@@ -2163,7 +2166,7 def cat(ui, repo, ctx, matcher, basefm, | |||
|
2163 | 2166 | def write(path): |
|
2164 | 2167 | filename = None |
|
2165 | 2168 | if fntemplate: |
|
2166 |
filename = makefilename( |
|
|
2169 | filename = makefilename(ctx, fntemplate, | |
|
2167 | 2170 | pathname=os.path.join(prefix, path)) |
|
2168 | 2171 | # attempt to create the directory if it does not already exist |
|
2169 | 2172 | try: |
@@ -476,7 +476,7 def archive(ui, repo, dest, **opts): | |||
|
476 | 476 | if not ctx: |
|
477 | 477 | raise error.Abort(_('no working directory: please specify a revision')) |
|
478 | 478 | node = ctx.node() |
|
479 |
dest = cmdutil.makefilename( |
|
|
479 | dest = cmdutil.makefilename(ctx, dest) | |
|
480 | 480 | if os.path.realpath(dest) == repo.root: |
|
481 | 481 | raise error.Abort(_('repository root cannot be destination')) |
|
482 | 482 | |
@@ -490,7 +490,7 def archive(ui, repo, dest, **opts): | |||
|
490 | 490 | if not prefix: |
|
491 | 491 | prefix = os.path.basename(repo.root) + '-%h' |
|
492 | 492 | |
|
493 |
prefix = cmdutil.makefilename( |
|
|
493 | prefix = cmdutil.makefilename(ctx, prefix) | |
|
494 | 494 | match = scmutil.match(ctx, [], opts) |
|
495 | 495 | archival.archive(repo, dest, node, kind, not opts.get('no_decode'), |
|
496 | 496 | match, prefix, subrepos=opts.get('subrepos')) |
General Comments 0
You need to be logged in to leave comments.
Login now