From patchwork Sat Feb 9 21:45:22 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: D5884: subrepo: adjust subrepo prefix before calling subrepo.add() (API) From: phabricator X-Patchwork-Id: 38593 Message-Id: <8b8aeed0e59ade1b4aafefb15b65c7d6@localhost.localdomain> To: mercurial-devel@mercurial-scm.org Date: Sat, 9 Feb 2019 21:45:22 +0000 This revision was automatically updated to reflect the committed changes. Closed by commit rHGed046348675c: subrepo: adjust subrepo prefix before calling subrepo.add() (API) (authored by martinvonz, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D5884?vs=13895&id=13957 REVISION DETAIL https://phab.mercurial-scm.org/D5884 AFFECTED FILES mercurial/cmdutil.py mercurial/subrepo.py CHANGE DETAILS To: martinvonz, #hg-reviewers Cc: mercurial-devel diff --git a/mercurial/subrepo.py b/mercurial/subrepo.py --- a/mercurial/subrepo.py +++ b/mercurial/subrepo.py @@ -518,9 +518,7 @@ @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): diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py --- a/mercurial/cmdutil.py +++ b/mercurial/cmdutil.py @@ -2059,10 +2059,11 @@ 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))