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