largefiles: eliminate a duplicate message when removing files in verbose mode
authorMatt Harbison <matt_harbison@yahoo.com>
Fri, 28 Nov 2014 14:21:02 -0500
changeset 23658 55c92618fdd4
parent 23657 95f238cafb32
child 23659 67d63ec85eb7
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.
hgext/largefiles/overrides.py
tests/test-largefiles.t
--- a/hgext/largefiles/overrides.py	Wed Dec 17 21:51:09 2014 -0500
+++ b/hgext/largefiles/overrides.py	Fri Nov 28 14:21:02 2014 -0500
@@ -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:
--- a/tests/test-largefiles.t	Wed Dec 17 21:51:09 2014 -0500
+++ b/tests/test-largefiles.t	Fri Nov 28 14:21:02 2014 -0500
@@ -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