[PATCH 8 of 9] subrepo: drop the 'ui' parameter to removefiles()

Matt Harbison mharbison72 at gmail.com
Sun Dec 14 19:12:45 CST 2014


# HG changeset patch
# User Matt Harbison <matt_harbison at yahoo.com>
# Date 1418517410 18000
#      Sat Dec 13 19:36:50 2014 -0500
# Node ID b58f5dcfe069ccf5154788c05348cc328b4f13f2
# Parent  36b4c3b1c31613abe989367ba57eee8d9033989c
subrepo: drop the 'ui' parameter to removefiles()

This no longer needs to be explicitly passed because the subrepo object tracks
the 'ui' reference since fcbc66b5da6a.  See the change to 'archive' for details
about the differences between the output level in the root repo and subrepo 'ui'
object.

The only use for 'ui' in remove is to emit status and warning messages, and to
check the verbose flag prior to printing files to be removed.  The bad() method
on the matcher still uses the root repo's ui, because narrowing the matcher
doesn't change the ui object.

The local repo's ui was already being used to print a warning message in
wctx.forget() and for 'ui.slash' when walking dirstate in the repo.status()
call.

diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -2075,8 +2075,7 @@
             sub = wctx.sub(subpath)
             try:
                 submatch = matchmod.narrowmatcher(subpath, m)
-                if sub.removefiles(ui, submatch, prefix, after, force,
-                                   subrepos):
+                if sub.removefiles(submatch, prefix, after, force, subrepos):
                     ret = 1
             except error.LookupError:
                 ui.status(_("skipping missing subrepository: %s\n")
diff --git a/mercurial/subrepo.py b/mercurial/subrepo.py
--- a/mercurial/subrepo.py
+++ b/mercurial/subrepo.py
@@ -499,7 +499,7 @@
     def forget(self, match, prefix):
         return ([], [])
 
-    def removefiles(self, ui, matcher, prefix, after, force, subrepos):
+    def removefiles(self, matcher, prefix, after, force, subrepos):
         """remove the matched files from the subrepository and the filesystem,
         possibly by force and/or after the file has been removed from the
         filesystem.  Return 0 on success, 1 on any warning.
@@ -855,8 +855,8 @@
                               os.path.join(prefix, self._path), True)
 
     @annotatesubrepoerror
-    def removefiles(self, ui, matcher, prefix, after, force, subrepos):
-        return cmdutil.remove(ui, self._repo, matcher,
+    def removefiles(self, matcher, prefix, after, force, subrepos):
+        return cmdutil.remove(self.ui, self._repo, matcher,
                               os.path.join(prefix, self._path), after, force,
                               subrepos)
 


More information about the Mercurial-devel mailing list