diff mercurial/subrepo.py @ 41661:f8b18583049f

add: pass around uipathfn and use instead of m.rel() (API) For now, the uipathfn we pass around always prints relative paths just like before, so this should have no effect. Well, there's one little change: I also made the "skipping missing subrepository: %s\n" message relative. Differential Revision: https://phab.mercurial-scm.org/D5901
author Martin von Zweigbergk <martinvonz@google.com>
date Thu, 07 Feb 2019 11:15:30 -0800
parents d8cdd5320f75
children b2df5dc3ebfb
line wrap: on
line diff
--- a/mercurial/subrepo.py	Fri Feb 08 10:32:48 2019 -0800
+++ b/mercurial/subrepo.py	Thu Feb 07 11:15:30 2019 -0800
@@ -287,7 +287,7 @@
         """
         raise NotImplementedError
 
-    def add(self, ui, match, prefix, explicitonly, **opts):
+    def add(self, ui, match, prefix, uipathfn, explicitonly, **opts):
         return []
 
     def addremove(self, matcher, prefix, opts):
@@ -516,8 +516,9 @@
             self._repo.vfs.write('hgrc', util.tonativeeol(''.join(lines)))
 
     @annotatesubrepoerror
-    def add(self, ui, match, prefix, explicitonly, **opts):
-        return cmdutil.add(ui, self._repo, match, prefix, explicitonly, **opts)
+    def add(self, ui, match, prefix, uipathfn, explicitonly, **opts):
+        return cmdutil.add(ui, self._repo, match, prefix, uipathfn,
+                           explicitonly, **opts)
 
     @annotatesubrepoerror
     def addremove(self, m, prefix, opts):
@@ -1590,7 +1591,7 @@
             return False
 
     @annotatesubrepoerror
-    def add(self, ui, match, prefix, explicitonly, **opts):
+    def add(self, ui, match, prefix, uipathfn, explicitonly, **opts):
         if self._gitmissing():
             return []
 
@@ -1614,7 +1615,7 @@
             if exact:
                 command.append("-f") #should be added, even if ignored
             if ui.verbose or not exact:
-                ui.status(_('adding %s\n') % match.rel(f))
+                ui.status(_('adding %s\n') % uipathfn(f))
 
             if f in tracked:  # hg prints 'adding' even if already tracked
                 if exact:
@@ -1624,7 +1625,7 @@
                 self._gitcommand(command + [f])
 
         for f in rejected:
-            ui.warn(_("%s already tracked!\n") % match.rel(f))
+            ui.warn(_("%s already tracked!\n") % uipathfn(f))
 
         return rejected