[PATCH 1 of 8] largefiles: eliminate a duplicate message when removing files in verbose mode

Matt Harbison mharbison72 at gmail.com
Tue Dec 23 20:56:13 UTC 2014


# HG changeset patch
# User Matt Harbison <matt_harbison at yahoo.com>
# Date 1417202462 18000
#      Fri Nov 28 14:21:02 2014 -0500
# Node ID 14255160990a6081b4eb91e901950bbdbc130d80
# Parent  17b2ab77f4539e2ed0dd00d1ceefcf1d6b165346
largefiles: eliminate a duplicate message when removing files in verbose mode

There is no --after for addremove, so the printing for addremove can be hoisted
out of the 'not after' check.  The difference between the two remove messages
reflects the existing difference between core remove and core addremove styles
for printing the file.

There are still some pre-existing issues here.  Core addremove only prints on
inexact matches or when verbose.  But since the largefiles that are being
removed are passed to removelargefiles() as a pattern list, there is never an
inexact match, which would keep the largefiles from being printed at all unless
verbose is specified.  Therefore, the output is a little more aggressive than
core.  The addremove print style here is also inconsistent with core- it should
use matcher.uipath(f) instead of f.  These can be fixed once a matcher is passed
in.

diff --git a/hgext/largefiles/overrides.py b/hgext/largefiles/overrides.py
--- a/hgext/largefiles/overrides.py
+++ b/hgext/largefiles/overrides.py
@@ -189,21 +189,16 @@
         result = warn(added, _('not removing %s: file has been marked for add'
                                ' (use forget to undo)\n')) or result
 
-    for f in sorted(remove):
-        if ui.verbose or not m.exact(f):
-            ui.status(_('removing %s\n') % m.rel(f))
-
     # Need to lock because standin files are deleted then removed from the
     # repository and we could race in-between.
     wlock = repo.wlock()
     try:
         lfdirstate = lfutil.openlfdirstate(ui, repo)
-        for f in remove:
-            if not after:
-                # If this is being called by addremove, notify the user that we
-                # are removing the file.
-                if isaddremove:
-                    ui.status(_('removing %s\n') % f)
+        for f in sorted(remove):
+            if isaddremove:
+                ui.status(_('removing %s\n') % f)
+            elif ui.verbose or not m.exact(f):
+                ui.status(_('removing %s\n') % m.rel(f))
 
             if not opts.get('dry_run'):
                 if not after:
diff --git a/tests/test-largefiles.t b/tests/test-largefiles.t
--- a/tests/test-largefiles.t
+++ b/tests/test-largefiles.t
@@ -491,7 +491,7 @@
   $ echo "testing addremove with patterns" > testaddremove.dat
   $ echo "normaladdremove" > normaladdremove
   $ cd ..
-  $ hg -R a addremove
+  $ hg -R a -v addremove
   removing sub/large4
   adding a/testaddremove.dat as a largefile (glob)
   removing normal3


More information about the Mercurial-devel mailing list