# HG changeset patch # User Yuya Nishihara # Date 1427984522 -32400 # Node ID 01280638bdb14f6dd3ab4929cc20f8c6196e8266 # Parent 707aba4d48b5bdf7a51e4e23b5fcc399c65c2aa2 cmdutil: make node parameter of makefileobj() mandatory (API) (repo, node) pair will be replaced with ctx, so makefilename() can be easily ported to templater. diff -r 707aba4d48b5 -r 01280638bdb1 mercurial/cmdutil.py --- a/mercurial/cmdutil.py Wed Feb 14 21:36:15 2018 +0900 +++ b/mercurial/cmdutil.py Thu Apr 02 23:22:02 2015 +0900 @@ -893,23 +893,17 @@ def makefilename(repo, pat, node, desc=None, total=None, seqno=None, revwidth=None, pathname=None): - node_expander = { + expander = { 'H': lambda: hex(node), 'R': lambda: '%d' % repo.changelog.rev(node), 'h': lambda: short(node), - 'm': lambda: re.sub('[^\w]', '_', desc or '') - } - expander = { + 'm': lambda: re.sub('[^\w]', '_', desc or ''), + 'r': lambda: ('%d' % repo.changelog.rev(node)).zfill(revwidth or 0), '%': lambda: '%', 'b': lambda: os.path.basename(repo.root), } try: - if node: - expander.update(node_expander) - if node: - expander['r'] = (lambda: - ('%d' % repo.changelog.rev(node)).zfill(revwidth or 0)) if total is not None: expander['N'] = lambda: '%d' % total if seqno is not None: @@ -960,7 +954,7 @@ def __exit__(self, exc_type, exc_value, exc_tb): pass -def makefileobj(repo, pat, node=None, desc=None, total=None, +def makefileobj(repo, pat, node, desc=None, total=None, seqno=None, revwidth=None, mode='wb', modemap=None, pathname=None): diff -r 707aba4d48b5 -r 01280638bdb1 mercurial/commands.py --- a/mercurial/commands.py Wed Feb 14 21:36:15 2018 +0900 +++ b/mercurial/commands.py Thu Apr 02 23:22:02 2015 +0900 @@ -486,7 +486,7 @@ if dest == '-': if kind == 'files': raise error.Abort(_('cannot archive plain files to stdout')) - dest = cmdutil.makefileobj(repo, dest) + dest = cmdutil.makefileobj(repo, dest, node) if not prefix: prefix = os.path.basename(repo.root) + '-%h'