Patchwork D5884: subrepo: adjust subrepo prefix before calling subrepo.add() (API)

login
register
mail settings
Submitter phabricator
Date Feb. 9, 2019, 9:45 p.m.
Message ID <8b8aeed0e59ade1b4aafefb15b65c7d6@localhost.localdomain>
Download mbox | patch
Permalink /patch/38593/
State Not Applicable
Headers show

Comments

phabricator - Feb. 9, 2019, 9:45 p.m.
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

Patch

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))