[PATCH 3 of 3] cmdutil: respect ui.slash when printing message about a move or copy

Simon Heimberg simohe at besonet.ch
Wed Mar 20 05:39:38 CDT 2013


# HG changeset patch
# User Simon Heimberg <simohe at besonet.ch>
# Date 1363775808 -3600
# Node ID 430140ecab96dbf32982a34259eb26f0e6ab3a7d
# Parent  bb678b1a26e52bcc390bb4f48896a1ed1db3bc35
cmdutil: respect ui.slash when printing message about a move or copy

Only the 2nd path respected the setting of ui.slash. This does not look
nice.
The message "moving x to y" was all printed with slashes when doing a merge.
Now this is also done here. The test output is easier to write now because glob
is never needed anymore after "  moving x/y to z".

The output on windows when ui.slash is set
was:
  moving a\b\c to x/y/z
and now is:
  moving a/b/c to x/y/z

When ui.slash is not set or when not running on windows, the output remains the
same as before (with os.sep).

Remove (glob) from all places where it was needed before.

diff -r bb678b1a26e5 -r 430140ecab96 mercurial/cmdutil.py
--- a/mercurial/cmdutil.py	Mit Mär 20 11:36:45 2013 +0100
+++ b/mercurial/cmdutil.py	Mit Mär 20 11:36:48 2013 +0100
@@ -346,9 +346,10 @@
 
         if ui.verbose or not exact:
             if rename:
-                ui.status(_('moving %s to %s\n') % (relsrc, reltarget))
+                msg = _('moving %s to %s\n')
             else:
-                ui.status(_('copying %s to %s\n') % (relsrc, reltarget))
+                msg = _('copying %s to %s\n')
+            ui.status(msg % (ui.disppath(relsrc), reltarget))
 
         targets[abstarget] = abssrc
 
diff -r bb678b1a26e5 -r 430140ecab96 tests/test-casefolding.t
--- a/tests/test-casefolding.t	Mit Mär 20 11:36:45 2013 +0100
+++ b/tests/test-casefolding.t	Mit Mär 20 11:36:48 2013 +0100
@@ -57,14 +57,14 @@
   A D/c
   $ hg ci -m addc D/c
   $ hg mv d/b d/e
-  moving D/b to D/e (glob)
+  moving D/b to D/e
   $ hg st
   A D/e
   R D/b
   $ hg revert -aq
   $ rm d/e
   $ hg mv d/b D/B
-  moving D/b to D/B (glob)
+  moving D/b to D/B
   $ hg st
   A D/B
   R D/b
diff -r bb678b1a26e5 -r 430140ecab96 tests/test-dirstate.t
--- a/tests/test-dirstate.t	Mit Mär 20 11:36:45 2013 +0100
+++ b/tests/test-dirstate.t	Mit Mär 20 11:36:48 2013 +0100
@@ -11,9 +11,9 @@
   adding a/b/c/d/y
   adding a/b/c/d/z
   $ hg mv a z
-  moving a/b/c/d/x to z/b/c/d/x (glob)
-  moving a/b/c/d/y to z/b/c/d/y (glob)
-  moving a/b/c/d/z to z/b/c/d/z (glob)
+  moving a/b/c/d/x to z/b/c/d/x
+  moving a/b/c/d/y to z/b/c/d/y
+  moving a/b/c/d/z to z/b/c/d/z
 
 Test name collisions
 
diff -r bb678b1a26e5 -r 430140ecab96 tests/test-issue612.t
--- a/tests/test-issue612.t	Mit Mär 20 11:36:45 2013 +0100
+++ b/tests/test-issue612.t	Mit Mär 20 11:36:48 2013 +0100
@@ -7,7 +7,7 @@
   adding src/a.c
 
   $ hg mv src source
-  moving src/a.c to source/a.c (glob)
+  moving src/a.c to source/a.c
 
   $ hg ci -Ammove
 
diff -r bb678b1a26e5 -r 430140ecab96 tests/test-mv-cp-st-diff.t
--- a/tests/test-mv-cp-st-diff.t	Mit Mär 20 11:36:45 2013 +0100
+++ b/tests/test-mv-cp-st-diff.t	Mit Mär 20 11:36:48 2013 +0100
@@ -1339,7 +1339,7 @@
   % hg ci -m t0
   created new head
   % hg mv x y
-  moving x/x to y/x (glob)
+  moving x/x to y/x
   % hg ci -m t1
   % add y/x x1
   % hg ci -m t2
diff -r bb678b1a26e5 -r 430140ecab96 tests/test-rename-dir-merge.t
--- a/tests/test-rename-dir-merge.t	Mit Mär 20 11:36:45 2013 +0100
+++ b/tests/test-rename-dir-merge.t	Mit Mär 20 11:36:48 2013 +0100
@@ -11,8 +11,8 @@
   $ hg co -C 0
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ hg mv a b
-  moving a/a to b/a (glob)
-  moving a/b to b/b (glob)
+  moving a/a to b/a
+  moving a/b to b/b
   $ hg ci -m "1 mv a/ b/"
 
   $ hg co -C 0
@@ -122,7 +122,7 @@
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ cd r2
   $ hg mv a b
-  moving a/f to b/f (glob)
+  moving a/f to b/f
   $ echo foo1 > b/f
   $ hg ci -m" a -> b, b/f == foo1"
   $ cd ..
diff -r bb678b1a26e5 -r 430140ecab96 tests/test-rename.t
--- a/tests/test-rename.t	Mit Mär 20 11:36:45 2013 +0100
+++ b/tests/test-rename.t	Mit Mär 20 11:36:48 2013 +0100
@@ -119,10 +119,10 @@
 rename directory d1 as d3
 
   $ hg rename d1/ d3
-  moving d1/a to d3/a (glob)
-  moving d1/b to d3/b (glob)
-  moving d1/ba to d3/ba (glob)
-  moving d1/d11/a1 to d3/d11/a1 (glob)
+  moving d1/a to d3/a
+  moving d1/b to d3/b
+  moving d1/ba to d3/ba
+  moving d1/d11/a1 to d3/d11/a1
   $ hg status -C
   A d3/a
     d1/a
@@ -144,10 +144,10 @@
 
   $ mv d1 d3
   $ hg rename --after d1 d3
-  moving d1/a to d3/a (glob)
-  moving d1/b to d3/b (glob)
-  moving d1/ba to d3/ba (glob)
-  moving d1/d11/a1 to d3/d11/a1 (glob)
+  moving d1/a to d3/a
+  moving d1/b to d3/b
+  moving d1/ba to d3/ba
+  moving d1/d11/a1 to d3/d11/a1
   $ hg status -C
   A d3/a
     d1/a
@@ -168,7 +168,7 @@
 move a directory using a relative path
 
   $ (cd d2; mkdir d3; hg rename ../d1/d11 d3)
-  moving ../d1/d11/a1 to d3/d11/a1 (glob)
+  moving ../d1/d11/a1 to d3/d11/a1
   $ hg status -C
   A d2/d3/d11/a1
     d1/d11/a1
@@ -180,7 +180,7 @@
 move --after a directory using a relative path
 
   $ (cd d2; mkdir d3; mv ../d1/d11 d3; hg rename --after ../d1/d11 d3)
-  moving ../d1/d11/a1 to d3/d11/a1 (glob)
+  moving ../d1/d11/a1 to d3/d11/a1
   $ hg status -C
   A d2/d3/d11/a1
     d1/d11/a1
@@ -192,7 +192,7 @@
 move directory d1/d11 to an existing directory d2 (removes empty d1)
 
   $ hg rename d1/d11/ d2
-  moving d1/d11/a1 to d2/d11/a1 (glob)
+  moving d1/d11/a1 to d2/d11/a1
   $ hg status -C
   A d2/d11/a1
     d1/d11/a1
@@ -205,11 +205,11 @@
 
   $ mkdir d3
   $ hg rename d1 d2 d3
-  moving d1/a to d3/d1/a (glob)
-  moving d1/b to d3/d1/b (glob)
-  moving d1/ba to d3/d1/ba (glob)
-  moving d1/d11/a1 to d3/d1/d11/a1 (glob)
-  moving d2/b to d3/d2/b (glob)
+  moving d1/a to d3/d1/a
+  moving d1/b to d3/d1/b
+  moving d1/ba to d3/d1/ba
+  moving d1/d11/a1 to d3/d1/d11/a1
+  moving d2/b to d3/d2/b
   $ hg status -C
   A d3/d1/a
     d1/a
@@ -235,11 +235,11 @@
   $ mkdir d3
   $ mv d1 d2 d3
   $ hg rename --after d1 d2 d3
-  moving d1/a to d3/d1/a (glob)
-  moving d1/b to d3/d1/b (glob)
-  moving d1/ba to d3/d1/ba (glob)
-  moving d1/d11/a1 to d3/d1/d11/a1 (glob)
-  moving d2/b to d3/d2/b (glob)
+  moving d1/a to d3/d1/a
+  moving d1/b to d3/d1/b
+  moving d1/ba to d3/d1/ba
+  moving d1/d11/a1 to d3/d1/d11/a1
+  moving d2/b to d3/d2/b
   $ hg status -C
   A d3/d1/a
     d1/a
@@ -265,7 +265,7 @@
 
   $ hg rename d1/* d2
   d2/b: not overwriting - file exists
-  moving d1/d11/a1 to d2/d11/a1 (glob)
+  moving d1/d11/a1 to d2/d11/a1
   $ hg status -C
   A d2/a
     d1/a
@@ -306,10 +306,10 @@
 
   $ mkdir d2/d21
   $ hg rename 'glob:d1/**' d2/d21
-  moving d1/a to d2/d21/a (glob)
-  moving d1/b to d2/d21/b (glob)
-  moving d1/ba to d2/d21/ba (glob)
-  moving d1/d11/a1 to d2/d21/a1 (glob)
+  moving d1/a to d2/d21/a
+  moving d1/b to d2/d21/b
+  moving d1/ba to d2/d21/ba
+  moving d1/d11/a1 to d2/d21/a1
   $ hg status -C
   A d2/d21/a
     d1/a
@@ -332,10 +332,10 @@
   $ mkdir d2/d21
   $ mv d1/a d1/d11/a1 d2/d21
   $ hg rename --after 'glob:d1/**' d2/d21
-  moving d1/a to d2/d21/a (glob)
+  moving d1/a to d2/d21/a
   d1/b: not recording move - d2/d21/b does not exist (glob)
   d1/ba: not recording move - d2/d21/ba does not exist (glob)
-  moving d1/d11/a1 to d2/d21/a1 (glob)
+  moving d1/d11/a1 to d2/d21/a1
   $ hg status -C
   A d2/d21/a
     d1/a
@@ -351,8 +351,8 @@
 
   $ mkdir d2/d21
   $ hg rename 're:d1/([^a][^/]*/)*a.*' d2/d21
-  moving d1/a to d2/d21/a (glob)
-  moving d1/d11/a1 to d2/d21/a1 (glob)
+  moving d1/a to d2/d21/a
+  moving d1/d11/a1 to d2/d21/a1
   $ hg status -C
   A d2/d21/a
     d1/a
@@ -415,7 +415,7 @@
 
   $ mkdir d3
   $ hg rename d1/* d2/* d3
-  moving d1/d11/a1 to d3/d11/a1 (glob)
+  moving d1/d11/a1 to d3/d11/a1
   d3/b: not overwriting - d2/b collides with d1/b
   $ hg status -C
   A d3/a
@@ -441,7 +441,7 @@
   moving a to ../d3/d1/a
   moving b to ../d3/d1/b
   moving ba to ../d3/d1/ba
-  moving d11/a1 to ../d3/d1/d11/a1 (glob)
+  moving d11/a1 to ../d3/d1/d11/a1
   $ hg status -C
   A d3/d1/a
     d1/a
@@ -467,7 +467,7 @@
   moving a to ../d3/a
   moving b to ../d3/b
   moving ba to ../d3/ba
-  moving d11/a1 to ../d3/d11/a1 (glob)
+  moving d11/a1 to ../d3/d11/a1
   $ hg status -C
   A d3/a
     d1/a
@@ -488,9 +488,9 @@
 move the parent tree with "hg rename .."
 
   $ (cd d1/d11; hg rename .. ../../d3)
-  moving ../a to ../../d3/a (glob)
-  moving ../b to ../../d3/b (glob)
-  moving ../ba to ../../d3/ba (glob)
+  moving ../a to ../../d3/a
+  moving ../b to ../../d3/b
+  moving ../ba to ../../d3/ba
   moving a1 to ../../d3/d11/a1
   $ hg status -C
   A d3/a
@@ -513,9 +513,9 @@
 
   $ hg remove d1/b
   $ hg rename d1 d3
-  moving d1/a to d3/a (glob)
-  moving d1/ba to d3/ba (glob)
-  moving d1/d11/a1 to d3/d11/a1 (glob)
+  moving d1/a to d3/a
+  moving d1/ba to d3/ba
+  moving d1/d11/a1 to d3/d11/a1
   $ hg status -C
   A d3/a
     d1/a


More information about the Mercurial-devel mailing list