D5900: subrepo: (mostly) use relative path in "skipping missing subrepository"

martinvonz (Martin von Zweigbergk) phabricator at mercurial-scm.org
Fri Feb 8 18:49:25 UTC 2019


martinvonz created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  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.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D5900

AFFECTED FILES
  mercurial/cmdutil.py
  mercurial/scmutil.py

CHANGE DETAILS

diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py
--- a/mercurial/scmutil.py
+++ b/mercurial/scmutil.py
@@ -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):
diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -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
 



To: martinvonz, #hg-reviewers
Cc: mercurial-devel


More information about the Mercurial-devel mailing list