Patchwork [7,of,8] largefiles: align the output messages for a removed file with core methods

login
register
mail settings
Submitter Matt Harbison
Date Dec. 23, 2014, 8:56 p.m.
Message ID <0fb59e8c02c8e55d947b.1419368179@Envy>
Download mbox | patch
Permalink /patch/7218/
State Superseded
Headers show

Comments

Matt Harbison - Dec. 23, 2014, 8:56 p.m.
# HG changeset patch
# User Matt Harbison <matt_harbison@yahoo.com>
# Date 1417226624 18000
#      Fri Nov 28 21:03:44 2014 -0500
# Node ID 0fb59e8c02c8e55d947b951e90ded7317d85bd4a
# Parent  eadacee126bd65a612e3a5a8240c42b45a3fc073
largefiles: align the output messages for a removed file with core methods

Both cmdutil.remove() and scmutil.addremove() require verbose mode or an inexact
match to print the filename.  Core addremove also prints the file relative to
cwd only if patterns are provided to the command.  And finally, both methods
print the subrepo prefix when needed.

Patch

diff --git a/hgext/largefiles/overrides.py b/hgext/largefiles/overrides.py
--- a/hgext/largefiles/overrides.py
+++ b/hgext/largefiles/overrides.py
@@ -192,10 +192,13 @@ 
     try:
         lfdirstate = lfutil.openlfdirstate(ui, repo)
         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 ui.verbose or not m.exact(f):
+                # addremove in core gets fancy with the name, remove doesn't
+                if isaddremove:
+                    name = m.uipath(f)
+                else:
+                    name = m.rel(f)
+                ui.status(_('removing %s\n') % name)
 
             if not opts.get('dry_run'):
                 if not after:
diff --git a/tests/test-largefiles-misc.t b/tests/test-largefiles-misc.t
--- a/tests/test-largefiles-misc.t
+++ b/tests/test-largefiles-misc.t
@@ -259,7 +259,7 @@ 
   $ mv subrepo/large.txt subrepo/renamed-large.txt
   $ hg addremove -S --dry-run
   adding large.dat as a largefile
-  removing large.txt
+  removing subrepo/large.txt (glob)
   adding subrepo/normal.txt (glob)
   adding subrepo/renamed-large.txt (glob)
   adding large.dat
@@ -270,7 +270,7 @@ 
   ? subrepo/renamed-large.txt
 
   $ hg addremove --dry-run subrepo
-  removing large.txt
+  removing subrepo/large.txt (glob)
   adding subrepo/normal.txt (glob)
   adding subrepo/renamed-large.txt (glob)
   $ hg status -S
@@ -281,7 +281,7 @@ 
   $ cd ..
 
   $ hg -R statusmatch addremove --dry-run statusmatch/subrepo
-  removing large.txt
+  removing statusmatch/subrepo/large.txt (glob)
   adding statusmatch/subrepo/normal.txt (glob)
   adding statusmatch/subrepo/renamed-large.txt (glob)
   $ hg -R statusmatch status -S
@@ -292,7 +292,7 @@ 
 
   $ hg -R statusmatch addremove --dry-run -S
   adding statusmatch/large.dat as a largefile (glob)
-  removing large.txt
+  removing subrepo/large.txt (glob)
   adding subrepo/normal.txt (glob)
   adding subrepo/renamed-large.txt (glob)
   adding large.dat
@@ -366,10 +366,8 @@ 
   $ hg status -S
 
   $ rm subrepo/large.txt
-
-NB: The path in the message is wrong
   $ hg addremove -S
-  removing large.txt
+  removing subrepo/large.txt (glob)
   $ hg st -S
   R subrepo/large.txt