tests/test-uncommit.t
branchmercurial-4.3
changeset 3418 85cdce113c2c
parent 3166 e1a230cc4527
parent 3411 e1f3e43a50a4
child 3591 98941c28f3e2
--- a/tests/test-uncommit.t	Sat Dec 16 23:40:39 2017 +0100
+++ b/tests/test-uncommit.t	Tue Jan 16 04:35:34 2018 +0100
@@ -459,3 +459,54 @@
   R g
   R m
   R n
+
+Testing the --revert flag of `hg uncommit`
+
+When working directory before uncommit is clean
+
+  $ hg amend
+  $ hg status
+  ? b
+
+  $ hg diff -c . --stat
+   aa |  1 +
+   b  |  1 -
+   c  |  1 -
+   d  |  1 +
+   e  |  1 +
+   f  |  1 -
+   ff |  1 +
+   g  |  1 -
+   h  |  1 +
+   j  |  1 +
+   k  |  1 +
+   l  |  1 +
+   m  |  1 -
+   n  |  1 -
+   o  |  1 +
+   15 files changed, 9 insertions(+), 6 deletions(-)
+  $ hg uncommit --revert --all
+  new changeset is empty
+  (use 'hg prune .' to remove it)
+  $ hg status
+
+When working directory is dirty before uncommit
+
+  $ echo foo > a
+  $ echo foo > b
+  $ echo foo > c
+  $ hg status
+  M a
+  M b
+  M c
+  $ hg amend
+  $ echo foo > foo
+  $ hg add foo
+  $ hg status
+  A foo
+
+  $ hg uncommit --revert --all
+  new changeset is empty
+  (use 'hg prune .' to remove it)
+  $ hg status
+  ? foo