# HG changeset patch # User Martin von Zweigbergk # Date 2019-02-07 17:59:27 # Node ID ed046348675cdcbbea8a396f708c367a929ce6a4 # Parent f92844cb942c6d99586c05cb8ef8f5d8c575cde4 subrepo: adjust subrepo prefix before calling subrepo.add() (API) Differential Revision: https://phab.mercurial-scm.org/D5884 diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py --- a/mercurial/cmdutil.py +++ b/mercurial/cmdutil.py @@ -2059,10 +2059,11 @@ def add(ui, repo, match, prefix, explici sub = wctx.sub(subpath) try: submatch = matchmod.subdirmatcher(subpath, match) + subprefix = repo.wvfs.reljoin(prefix, subpath) if opts.get(r'subrepos'): - bad.extend(sub.add(ui, submatch, prefix, False, **opts)) + bad.extend(sub.add(ui, submatch, subprefix, False, **opts)) else: - bad.extend(sub.add(ui, submatch, prefix, True, **opts)) + bad.extend(sub.add(ui, submatch, subprefix, True, **opts)) except error.LookupError: ui.status(_("skipping missing subrepository: %s\n") % join(subpath)) diff --git a/mercurial/subrepo.py b/mercurial/subrepo.py --- a/mercurial/subrepo.py +++ b/mercurial/subrepo.py @@ -518,9 +518,7 @@ class hgsubrepo(abstractsubrepo): @annotatesubrepoerror def add(self, ui, match, prefix, explicitonly, **opts): - return cmdutil.add(ui, self._repo, match, - self.wvfs.reljoin(prefix, self._path), - explicitonly, **opts) + return cmdutil.add(ui, self._repo, match, prefix, explicitonly, **opts) @annotatesubrepoerror def addremove(self, m, prefix, opts):