largefiles: align the output messages for a removed file with core methods
authorMatt Harbison <matt_harbison@yahoo.com>
Fri, 28 Nov 2014 21:03:44 -0500
changeset 23766 ce0731e58ac9
parent 23765 537a2669a113
child 23767 749dc66e9329
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.
hgext/largefiles/overrides.py
tests/test-largefiles-misc.t
--- a/hgext/largefiles/overrides.py	Thu Nov 06 14:55:18 2014 -0800
+++ b/hgext/largefiles/overrides.py	Fri Nov 28 21:03:44 2014 -0500
@@ -190,10 +190,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:
--- a/tests/test-largefiles-misc.t	Thu Nov 06 14:55:18 2014 -0800
+++ b/tests/test-largefiles-misc.t	Fri Nov 28 21:03:44 2014 -0500
@@ -257,21 +257,55 @@
   $ echo 'normal file' > subrepo/normal.txt
   $ touch large.dat
   $ mv subrepo/large.txt subrepo/renamed-large.txt
-  $ hg -R subrepo addremove --dry-run
-  removing large.txt
-  adding normal.txt
-  adding renamed-large.txt
+  $ hg addremove -S --dry-run
+  adding large.dat as a largefile
+  removing subrepo/large.txt
+  adding subrepo/normal.txt
+  adding subrepo/renamed-large.txt
+  adding large.dat
+  $ hg status -S
+  ! subrepo/large.txt
+  ? large.dat
+  ? subrepo/normal.txt
+  ? subrepo/renamed-large.txt
+
+  $ hg addremove --dry-run subrepo
+  removing subrepo/large.txt (glob)
+  adding subrepo/normal.txt (glob)
+  adding subrepo/renamed-large.txt (glob)
   $ hg status -S
   ! subrepo/large.txt
   ? large.dat
   ? subrepo/normal.txt
   ? subrepo/renamed-large.txt
+  $ cd ..
+
+  $ hg -R statusmatch addremove --dry-run statusmatch/subrepo
+  removing statusmatch/subrepo/large.txt (glob)
+  adding statusmatch/subrepo/normal.txt (glob)
+  adding statusmatch/subrepo/renamed-large.txt (glob)
+  $ hg -R statusmatch status -S
+  ! subrepo/large.txt
+  ? large.dat
+  ? subrepo/normal.txt
+  ? subrepo/renamed-large.txt
+
+  $ hg -R statusmatch addremove --dry-run -S
+  adding statusmatch/large.dat as a largefile (glob)
+  removing subrepo/large.txt
+  adding subrepo/normal.txt
+  adding subrepo/renamed-large.txt
+  adding large.dat
+  $ cd statusmatch
+
   $ mv subrepo/renamed-large.txt subrepo/large.txt
-  $ hg -R subrepo add subrepo/normal.txt
+  $ hg addremove subrepo
+  adding subrepo/normal.txt (glob)
+  $ hg forget subrepo/normal.txt
 
-  $ hg addremove subrepo
   $ hg addremove -S
   adding large.dat as a largefile
+  adding subrepo/normal.txt
   $ rm large.dat
 
   $ hg addremove subrepo
@@ -330,6 +364,12 @@
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ hg status -S
 
+  $ rm subrepo/large.txt
+  $ hg addremove -S
+  removing subrepo/large.txt
+  $ hg st -S
+  R subrepo/large.txt
+
 Test archiving a revision that references a subrepo that is not yet
 cloned (see test-subrepo-recursion.t):