diff tests/test-uncommit.t @ 3389:eacf6149b678

uncommit: add a new flag `--revert` to discard wdir changes after uncommit This patch adds a new flag to `hg uncommit` using which one can discard the wdir changes which are left after the operation. Both the changes, the ones which were before the uncommit and the ones which were added to wdir as a result of uncommit as cleared out.
author Pulkit Goyal <7895pulkit@gmail.com>
date Tue, 09 Jan 2018 20:01:50 +0530
parents 1905aac253f0
children 39112fd4d5ed
line wrap: on
line diff
--- a/tests/test-uncommit.t	Tue Jan 09 15:39:47 2018 +0530
+++ b/tests/test-uncommit.t	Tue Jan 09 20:01:50 2018 +0530
@@ -461,3 +461,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