##// END OF EJS Templates
add: pass options via keyword args...
Matt Harbison -
r23885:9994f45b default
parent child Browse files
Show More
@@ -1979,7 +1979,7 b' def graphrevs(repo, nodes, opts):'
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
@@ -2003,17 +2003,15 b' def add(ui, repo, match, dryrun, listsub'
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
@@ -199,8 +199,7 b' def add(ui, repo, *pats, **opts):'
199 """
199 """
200
200
201 m = scmutil.match(repo[None], pats, opts)
201 m = scmutil.match(repo[None], pats, opts)
202 rejected = cmdutil.add(ui, repo, m, opts.get('dry_run'),
202 rejected = cmdutil.add(ui, repo, m, "", False, **opts)
203 opts.get('subrepos'), prefix="", explicitonly=False)
204 return rejected and 1 or 0
203 return rejected and 1 or 0
205
204
206 @command('addremove',
205 @command('addremove',
@@ -621,9 +621,10 b' class hgsubrepo(abstractsubrepo):'
621 fp.close()
621 fp.close()
622
622
623 @annotatesubrepoerror
623 @annotatesubrepoerror
624 def add(self, ui, match, dryrun, listsubrepos, prefix, explicitonly):
624 def add(self, ui, match, prefix, explicitonly, **opts):
625 return cmdutil.add(ui, self._repo, match, dryrun, listsubrepos,
625 return cmdutil.add(ui, self._repo, match,
626 os.path.join(prefix, self._path), explicitonly)
626 os.path.join(prefix, self._path), explicitonly,
627 **opts)
627
628
628 def addremove(self, m, prefix, opts, dry_run, similarity):
629 def addremove(self, m, prefix, opts, dry_run, similarity):
629 # In the same way as sub directories are processed, once in a subrepo,
630 # In the same way as sub directories are processed, once in a subrepo,
General Comments 0
You need to be logged in to leave comments. Login now