revert: issue "no changes needed" message for files missing on both side
authorPierre-Yves David <pierre-yves.david@fb.com>
Thu, 31 Jul 2014 16:03:26 -0700
changeset 22156 03a45eff9d2b
parent 22155 530390629842
child 22157 bd45d92883f9
revert: issue "no changes needed" message for files missing on both side When a file was marked as removed in the working copy and did not existed in the target of the revert, we did not issued any message pointing that no change was needed to the file (implicitly saying that revert had changed the file). We now properly issue a message in this situation. Tests change in and handful of case where the message was documented as missing.
mercurial/cmdutil.py
tests/test-revert.t
--- a/mercurial/cmdutil.py	Tue Jun 24 15:47:12 2014 +0100
+++ b/mercurial/cmdutil.py	Thu Jul 31 16:03:26 2014 -0700
@@ -2466,7 +2466,11 @@
             for table, (action, backup) in disptable:
                 if abs not in table:
                     continue
-                if action is not None:
+                if action is None:
+                    if exact:
+                        ui.warn(_('no changes needed to %s\n') % rel)
+
+                else:
                     handle(action, backup)
                 break
             else:
--- a/tests/test-revert.t	Tue Jun 24 15:47:12 2014 +0100
+++ b/tests/test-revert.t	Thu Jul 31 16:03:26 2014 -0700
@@ -143,9 +143,10 @@
   $ hg st d
   R d
 
-should silently keep d removed
+should keep d removed
 
   $ hg revert -r0 d
+  no changes needed to d
   $ hg st d
   R d
 
@@ -1104,14 +1105,9 @@
 - fails to report no change to revert for
 |
 | - clean_clean
-| - added_revert
 | - clean_revert
 | - modified_revert
 | - removed_revert
-| - added_removed
-| - added_untracked-clean
-| - added_untracked-revert
-| - added_untracked-wc
 
   $ for file in `python ../gen-revert-cases.py filelist`; do
   >   echo '### revert for:' $file;
@@ -1123,14 +1119,19 @@
   ### revert for: added_deleted
   
   ### revert for: added_removed
+  no changes needed to added_removed
   
   ### revert for: added_revert
+  no changes needed to added_revert
   
   ### revert for: added_untracked-clean
+  no changes needed to added_untracked-clean
   
   ### revert for: added_untracked-revert
+  no changes needed to added_untracked-revert
   
   ### revert for: added_untracked-wc
+  no changes needed to added_untracked-wc
   
   ### revert for: added_wc