[PATCH 5 of 8 V3] commit: propagate --addremove to subrepos if -S is specified (issue3759)

Martin von Zweigbergk martinvonz at google.com
Fri Dec 12 11:59:31 CST 2014


On Thu Dec 11 2014 at 7:36:39 PM Matt Harbison <mharbison72 at gmail.com>
wrote:

> diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py
> --- a/mercurial/scmutil.py
> +++ b/mercurial/scmutil.py
> @@ -713,13 +713,28 @@
>      '''Return a matcher that will efficiently match exactly these
> files.'''
>      return matchmod.exact(repo.root, repo.getcwd(), files)
>
> -def addremove(repo, matcher, opts={}, dry_run=None, similarity=None):
> +def addremove(repo, matcher, prefix, opts={}, dry_run=None,
> similarity=None):
>      m = matcher
>      if dry_run is None:
>          dry_run = opts.get('dry_run')
>      if similarity is None:
>          similarity = float(opts.get('similarity') or 0)
>
> +    ret = 0
> +    join = lambda f: os.path.join(prefix, f)
> +
> +    wctx = repo[None]
> +    for subpath in sorted(wctx.substate):
> +        if opts.get('subrepos'):
> +            sub = wctx.sub(subpath)
> +            try:
> +                submatch = matchmod.narrowmatcher(subpath, m)
> +                if sub.addremove(submatch, prefix, opts, dry_run,
> similarity):
> +                    ret = 1
> +            except error.LookupError:
> +                repo.ui.status(_("skipping missing subrepository: %s\n")
> +                                 % join(subpath))
> +
>

The other pieces of similar code live in cmdutil. Do you know why this
function is not there?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://selenic.com/pipermail/mercurial-devel/attachments/20141212/2c1558d1/attachment.html>


More information about the Mercurial-devel mailing list