changeset 41639:ed046348675c

subrepo: adjust subrepo prefix before calling subrepo.add() (API) Differential Revision: https://phab.mercurial-scm.org/D5884
author Martin von Zweigbergk <martinvonz@google.com>
date Thu, 07 Feb 2019 09:59:27 -0800
parents f92844cb942c
children 5ee3c49fc9cd
files mercurial/cmdutil.py mercurial/subrepo.py
diffstat 2 files changed, 4 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/cmdutil.py	Thu Feb 07 09:52:22 2019 -0800
+++ b/mercurial/cmdutil.py	Thu Feb 07 09:59:27 2019 -0800
@@ -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))
--- a/mercurial/subrepo.py	Thu Feb 07 09:52:22 2019 -0800
+++ b/mercurial/subrepo.py	Thu Feb 07 09:59:27 2019 -0800
@@ -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):