changeset 41649:799e156785f7

subrepo: (mostly) use relative path in "skipping missing subrepository" This is consistent with the other messages printed by these functions. Note that addremove is a little different and prints absolute (aka repo-relative) paths if no argument was given. Differential Revision: https://phab.mercurial-scm.org/D5900
author Martin von Zweigbergk <martinvonz@google.com>
date Fri, 08 Feb 2019 10:32:48 -0800
parents d8cdd5320f75
children f8b18583049f
files mercurial/cmdutil.py mercurial/scmutil.py
diffstat 2 files changed, 8 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/cmdutil.py	Fri Feb 08 10:19:30 2019 -0800
+++ b/mercurial/cmdutil.py	Fri Feb 08 10:32:48 2019 -0800
@@ -2028,7 +2028,6 @@
     return iterate()
 
 def add(ui, repo, match, prefix, explicitonly, **opts):
-    join = lambda f: os.path.join(prefix, f)
     bad = []
 
     badfn = lambda x, y: bad.append(x) or match.bad(x, y)
@@ -2066,7 +2065,7 @@
                 bad.extend(sub.add(ui, submatch, subprefix, True, **opts))
         except error.LookupError:
             ui.status(_("skipping missing subrepository: %s\n")
-                           % join(subpath))
+                           % match.rel(subpath))
 
     if not opts.get(r'dry_run'):
         rejected = wctx.add(names, prefix)
@@ -2085,7 +2084,6 @@
 def forget(ui, repo, match, prefix, explicitonly, dryrun, interactive):
     if dryrun and interactive:
         raise error.Abort(_("cannot specify both --dry-run and --interactive"))
-    join = lambda f: os.path.join(prefix, f)
     bad = []
     badfn = lambda x, y: bad.append(x) or match.bad(x, y)
     wctx = repo[None]
@@ -2107,7 +2105,7 @@
             forgot.extend([subpath + '/' + f for f in subforgot])
         except error.LookupError:
             ui.status(_("skipping missing subrepository: %s\n")
-                           % join(subpath))
+                           % match.rel(subpath))
 
     if not explicitonly:
         for f in match.files():
@@ -2187,12 +2185,11 @@
                     ret = 0
             except error.LookupError:
                 ui.status(_("skipping missing subrepository: %s\n")
-                               % m.abs(subpath))
+                               % m.rel(subpath))
 
     return ret
 
 def remove(ui, repo, m, prefix, after, force, subrepos, dryrun, warnings=None):
-    join = lambda f: os.path.join(prefix, f)
     ret = 0
     s = repo.status(match=m, clean=True)
     modified, added, deleted, clean = s[0], s[1], s[3], s[6]
@@ -2220,7 +2217,7 @@
                     ret = 1
             except error.LookupError:
                 warnings.append(_("skipping missing subrepository: %s\n")
-                               % join(subpath))
+                               % m.rel(subpath))
     progress.complete()
 
     # warn about failure to delete explicit files/dirs
@@ -2364,12 +2361,13 @@
         sub = ctx.sub(subpath)
         try:
             submatch = matchmod.subdirmatcher(subpath, matcher)
-            subprefix = os.path.join(prefix, sub._path)
+            subprefix = os.path.join(prefix, subpath)
             if not sub.cat(submatch, basefm, fntemplate, subprefix,
                            **pycompat.strkwargs(opts)):
                 err = 0
         except error.RepoLookupError:
-            ui.status(_("skipping missing subrepository: %s\n") % subprefix)
+            ui.status(_("skipping missing subrepository: %s\n") %
+                      matcher.rel(subpath))
 
     return err
 
--- a/mercurial/scmutil.py	Fri Feb 08 10:19:30 2019 -0800
+++ b/mercurial/scmutil.py	Fri Feb 08 10:32:48 2019 -0800
@@ -1040,7 +1040,6 @@
     similarity /= 100.0
 
     ret = 0
-    join = lambda f: os.path.join(prefix, f)
 
     wctx = repo[None]
     for subpath in sorted(wctx.substate):
@@ -1053,7 +1052,7 @@
                     ret = 1
             except error.LookupError:
                 repo.ui.status(_("skipping missing subrepository: %s\n")
-                                 % join(subpath))
+                                 % m.uipath(subpath))
 
     rejected = []
     def badfn(f, msg):