Patchwork [2,of,6] revset: also track clean files

login
register
mail settings
Submitter Pierre-Yves David
Date Aug. 14, 2014, 9:35 p.m.
Message ID <1e832b11013b1c024a2b.1408052156@marginatus.alto.octopoid.net>
Download mbox | patch
Permalink /patch/5396/
State Accepted
Headers show

Comments

Pierre-Yves David - Aug. 14, 2014, 9:35 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@fb.com>
# Date 1406847176 25200
#      Thu Jul 31 15:52:56 2014 -0700
# Node ID 1e832b11013b1c024a2be8976681e3fef0e8ea16
# Parent  961f7bc8ba57c53eb9bfed1be1a06a672cbf77d6
revset: also track clean files

Tracking clean files is the simplest way to be able to reports files that needs
no changes. So we explicitly retrieve them.

This fixes a couple of tests output where the lack of changes was not reported.

This also impact the shelve output because it use revert internaly. Some way to
silence them again (or stop using revert) will have to be found in the future.

Patch

diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -2372,10 +2372,11 @@  def revert(ui, repo, ctx, parents, *pats
         changes = repo.status(node1=node, match=m, clean=True)
         modified = set(changes[0])
         added    = set(changes[1])
         removed  = set(changes[2])
         _deleted  = set(changes[3])
+        clean    = set(changes[6])
 
         # split between files known in target manifest and the others
         smf = set(mf)
 
         # determine the exact nature of the deleted changesets
@@ -2440,10 +2441,11 @@  def revert(ui, repo, ctx, parents, *pats
             (missingmodified,  (actions['remove'],   True)),
             (dsadded,          (actions['revert'],   True)),
             (missingadded,     (actions['remove'],   False)),
             (dsremoved,        (actions['undelete'], True)),
             (missingremoved,   (None,                False)),
+            (clean,            (None,                False)),
             )
 
         for abs, (rel, exact) in sorted(names.items()):
             # hash on file in target manifest (or None if missing from target)
             mfentry = mf.get(abs)
diff --git a/tests/test-revert.t b/tests/test-revert.t
--- a/tests/test-revert.t
+++ b/tests/test-revert.t
@@ -1102,12 +1102,10 @@  revert all files individually and check 
 
 Misbehavior:
 
 - fails to report no change to revert for
 |
-| - clean_clean
-| - clean_revert
 | - modified_revert
 | - removed_revert
 
   $ for file in `python ../gen-revert-cases.py filelist`; do
   >   echo '### revert for:' $file;
@@ -1134,16 +1132,18 @@  Misbehavior:
   no changes needed to added_untracked-wc
   
   ### revert for: added_wc
   
   ### revert for: clean_clean
+  no changes needed to clean_clean
   
   ### revert for: clean_deleted
   
   ### revert for: clean_removed
   
   ### revert for: clean_revert
+  no changes needed to clean_revert
   
   ### revert for: clean_untracked-clean
   
   ### revert for: clean_untracked-revert
   
diff --git a/tests/test-shelve.t b/tests/test-shelve.t
--- a/tests/test-shelve.t
+++ b/tests/test-shelve.t
@@ -265,10 +265,11 @@  abort the unshelve and be happy
   M c.copy
   R b/b
   ? a/a.orig
   $ hg unshelve -a
   rebase aborted
+  no changes needed to a/a
   unshelve of 'default' aborted
   $ hg heads -q
   3:2e69b451d1ea
   $ hg parents
   changeset:   3:2e69b451d1ea
@@ -385,10 +386,11 @@  if we resolve a conflict while unshelvin
   $ HGMERGE=true hg unshelve
   unshelving change 'default'
   temporarily committing pending changes (restore with 'hg unshelve --abort')
   rebasing shelved changes
   merging a/a
+  no changes needed to a/a
   $ hg parents -q
   4:33f7f61e6c5e
   $ hg shelve -l
   $ hg status
   A foo/foo
@@ -404,10 +406,11 @@  test keep and cleanup
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
   $ hg shelve --list
   default         (*)    changes to 'create conflict' (glob)
   $ hg unshelve --keep
   unshelving change 'default'
+  no changes needed to a/a
   $ hg shelve --list
   default         (*)    changes to 'create conflict' (glob)
   $ hg shelve --cleanup
   $ hg shelve --list
 
@@ -431,10 +434,11 @@  test bookmarks
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
   $ hg bookmark
    * test                      4:33f7f61e6c5e
   $ hg unshelve
   unshelving change 'test'
+  no changes needed to a/a
   $ hg bookmark
    * test                      4:33f7f61e6c5e
 
 shelve should still work even if mq is disabled
 
@@ -443,10 +447,11 @@  shelve should still work even if mq is d
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
   $ hg --config extensions.mq=! shelve --list
   test            (*)    changes to 'create conflict' (glob)
   $ hg --config extensions.mq=! unshelve
   unshelving change 'test'
+  no changes needed to a/a
 
 shelve should leave dirstate clean (issue 4055)
 
   $ cd ..
   $ hg init shelverebase
@@ -468,10 +473,11 @@  shelve should leave dirstate clean (issu
   merging x
   saved backup bundle to $TESTTMP/shelverebase/.hg/strip-backup/323bfa07f744-backup.hg (glob)
   $ hg unshelve
   unshelving change 'default'
   rebasing shelved changes
+  no changes needed to x
   $ hg status
   M z
 
   $ cd ..
 
@@ -494,10 +500,11 @@  shelve should only unshelve pending chan
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
   $ hg up -q 1
   $ hg unshelve
   unshelving change 'default'
   rebasing shelved changes
+  no changes needed to b
   $ hg status
   A d
 
 unshelve should work on an ancestor of the original commit
 
@@ -507,10 +514,11 @@  unshelve should work on an ancestor of t
   $ hg up 0
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
   $ hg unshelve
   unshelving change 'default'
   rebasing shelved changes
+  no changes needed to a
   $ hg status
   A d
 
 test bug 4073 we need to enable obsolete markers for it
 
@@ -524,10 +532,11 @@  test bug 4073 we need to enable obsolete
   shelved as default
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
   $ hg debugobsolete `hg --debug id -i -r 1`
   $ hg unshelve
   unshelving change 'default'
+  no changes needed to a
 
 unshelve should leave unknown files alone (issue4113)
 
   $ echo e > e
   $ hg shelve
@@ -535,10 +544,11 @@  unshelve should leave unknown files alon
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
   $ hg status
   ? e
   $ hg unshelve
   unshelving change 'default'
+  no changes needed to a
   $ hg status
   A d
   ? e
   $ cat e
   e
@@ -550,10 +560,11 @@  unshelve should keep a copy of unknown f
   shelved as default
   0 files updated, 0 files merged, 2 files removed, 0 files unresolved
   $ echo z > e
   $ hg unshelve
   unshelving change 'default'
+  no changes needed to a
   $ cat e
   e
   $ cat e.orig
   z
 
@@ -574,10 +585,12 @@  unshelve and conflicts with tracked and 
   shelved as default
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
   $ echo g > f
   $ hg unshelve
   unshelving change 'default'
+  no changes needed to d
+  no changes needed to e
   $ hg st
   A f
   ? f.orig
   $ cat f
   f
@@ -635,10 +648,12 @@  unshelve and conflicts with tracked and 
   >>>>>>> source: 23b29cada8ba - shelve: changes to 'commit stuff'
   $ cat f.orig
   g
   $ hg unshelve --abort
   rebase aborted
+  no changes needed to d
+  no changes needed to e
   unshelve of 'default' aborted
   $ hg st
   M a
   ? f.orig
   $ cat f.orig