--- a/hgext/extdiff.py Thu Apr 02 23:22:02 2015 +0900
+++ b/hgext/extdiff.py Thu Apr 02 23:32:28 2015 +0900
@@ -256,8 +256,8 @@
cmdutil.export(repo, [repo[node1a].rev(), repo[node2].rev()],
fntemplate=repo.vfs.reljoin(tmproot, template),
match=matcher)
- label1a = cmdutil.makefilename(repo, template, node1a)
- label2 = cmdutil.makefilename(repo, template, node2)
+ label1a = cmdutil.makefilename(repo[node1a], template)
+ label2 = cmdutil.makefilename(repo[node2], template)
dir1a = repo.vfs.reljoin(tmproot, label1a)
dir2 = repo.vfs.reljoin(tmproot, label2)
dir1b = None
--- a/hgext/patchbomb.py Thu Apr 02 23:22:02 2015 +0900
+++ b/hgext/patchbomb.py Thu Apr 02 23:32:28 2015 +0900
@@ -265,11 +265,10 @@
if patchtags:
patchname = patchtags[0]
elif total > 1:
- patchname = cmdutil.makefilename(repo, '%b-%n.patch',
- binnode, seqno=idx,
- total=total)
+ patchname = cmdutil.makefilename(repo[node], '%b-%n.patch',
+ seqno=idx, total=total)
else:
- patchname = cmdutil.makefilename(repo, '%b.patch', binnode)
+ patchname = cmdutil.makefilename(repo[node], '%b.patch')
disposition = 'inline'
if opts.get('attach'):
disposition = 'attachment'
--- a/mercurial/cmdutil.py Thu Apr 02 23:22:02 2015 +0900
+++ b/mercurial/cmdutil.py Thu Apr 02 23:32:28 2015 +0900
@@ -891,8 +891,10 @@
else:
return commiteditor
-def makefilename(repo, pat, node, desc=None,
+def makefilename(ctx, pat, desc=None,
total=None, seqno=None, revwidth=None, pathname=None):
+ repo = ctx.repo()
+ node = ctx.node()
expander = {
'H': lambda: hex(node),
'R': lambda: '%d' % repo.changelog.rev(node),
@@ -966,7 +968,8 @@
else:
fp = repo.ui.fin
return _unclosablefile(fp)
- fn = makefilename(repo, pat, node, desc, total, seqno, revwidth, pathname)
+ ctx = repo[node]
+ fn = makefilename(ctx, pat, desc, total, seqno, revwidth, pathname)
if modemap is not None:
mode = modemap.get(fn, mode)
if mode == 'wb':
@@ -2163,7 +2166,7 @@
def write(path):
filename = None
if fntemplate:
- filename = makefilename(repo, fntemplate, ctx.node(),
+ filename = makefilename(ctx, fntemplate,
pathname=os.path.join(prefix, path))
# attempt to create the directory if it does not already exist
try:
--- a/mercurial/commands.py Thu Apr 02 23:22:02 2015 +0900
+++ b/mercurial/commands.py Thu Apr 02 23:32:28 2015 +0900
@@ -476,7 +476,7 @@
if not ctx:
raise error.Abort(_('no working directory: please specify a revision'))
node = ctx.node()
- dest = cmdutil.makefilename(repo, dest, node)
+ dest = cmdutil.makefilename(ctx, dest)
if os.path.realpath(dest) == repo.root:
raise error.Abort(_('repository root cannot be destination'))
@@ -490,7 +490,7 @@
if not prefix:
prefix = os.path.basename(repo.root) + '-%h'
- prefix = cmdutil.makefilename(repo, prefix, node)
+ prefix = cmdutil.makefilename(ctx, prefix)
match = scmutil.match(ctx, [], opts)
archival.archive(repo, dest, node, kind, not opts.get('no_decode'),
match, prefix, subrepos=opts.get('subrepos'))