comparison mercurial/cmdutil.py @ 23885:9994f45ba714

add: pass options via keyword args The largefiles extensions needs to be able to pass --large, --normal and --lfsize to subrepos via cmdutil.add() and hgsubrepo.add(). Rather than add additional special purpose arguments, stop extracting the existing args from the **opts passed to commands.add() and just pass them along.
author Matt Harbison <matt_harbison@yahoo.com>
date Mon, 12 Jan 2015 20:59:17 -0500
parents 48fd1dfb99aa
children 8a29897d42d2
comparison
equal deleted inserted replaced
23884:ec2c2e1400f0 23885:9994f45ba714
1977 nodes.reverse() 1977 nodes.reverse()
1978 if limit is not None: 1978 if limit is not None:
1979 nodes = nodes[:limit] 1979 nodes = nodes[:limit]
1980 return graphmod.nodes(repo, nodes) 1980 return graphmod.nodes(repo, nodes)
1981 1981
1982 def add(ui, repo, match, dryrun, listsubrepos, prefix, explicitonly): 1982 def add(ui, repo, match, prefix, explicitonly, **opts):
1983 join = lambda f: os.path.join(prefix, f) 1983 join = lambda f: os.path.join(prefix, f)
1984 bad = [] 1984 bad = []
1985 oldbad = match.bad 1985 oldbad = match.bad
1986 match.bad = lambda x, y: bad.append(x) or oldbad(x, y) 1986 match.bad = lambda x, y: bad.append(x) or oldbad(x, y)
1987 names = [] 1987 names = []
2001 2001
2002 for subpath in sorted(wctx.substate): 2002 for subpath in sorted(wctx.substate):
2003 sub = wctx.sub(subpath) 2003 sub = wctx.sub(subpath)
2004 try: 2004 try:
2005 submatch = matchmod.narrowmatcher(subpath, match) 2005 submatch = matchmod.narrowmatcher(subpath, match)
2006 if listsubrepos: 2006 if opts.get('subrepos'):
2007 bad.extend(sub.add(ui, submatch, dryrun, listsubrepos, prefix, 2007 bad.extend(sub.add(ui, submatch, prefix, False, **opts))
2008 False))
2009 else: 2008 else:
2010 bad.extend(sub.add(ui, submatch, dryrun, listsubrepos, prefix, 2009 bad.extend(sub.add(ui, submatch, prefix, True, **opts))
2011 True))
2012 except error.LookupError: 2010 except error.LookupError:
2013 ui.status(_("skipping missing subrepository: %s\n") 2011 ui.status(_("skipping missing subrepository: %s\n")
2014 % join(subpath)) 2012 % join(subpath))
2015 2013
2016 if not dryrun: 2014 if not opts.get('dry_run'):
2017 rejected = wctx.add(names, prefix) 2015 rejected = wctx.add(names, prefix)
2018 bad.extend(f for f in rejected if f in match.files()) 2016 bad.extend(f for f in rejected if f in match.files())
2019 return bad 2017 return bad
2020 2018
2021 def forget(ui, repo, match, prefix, explicitonly): 2019 def forget(ui, repo, match, prefix, explicitonly):