[PATCH 3 of 3] Add a new test for the forget command

Steve Losh steve at stevelosh.com
Sun May 31 13:38:51 CDT 2009


# HG changeset patch
# User Steve Losh <steve at stevelosh.com>
# Date 1243792788 14400
# Node ID 7956a823daa3b0aaa57fb52310c3bf8249bbc188
# Parent  e177c1414c81e5d8ebea9e46c025f354d4f526d1
Add a new test for the forget command.

diff --git a/tests/test-forget b/tests/test-forget
new file mode 100755
--- /dev/null
+++ b/tests/test-forget
@@ -0,0 +1,47 @@
+#!/bin/sh
+
+forget() {
+    hg status
+    hg forget $@
+    hg status
+    # do not use ls -R, which recurses in .hg subdirs on Mac OS X 10.5
+    find . -name .hg -prune -o -type f -print | sort
+    hg commit -m1
+    hg status
+    find . -name .hg -prune -o -type f -print | sort
+}
+
+hg init test-forget
+cd test-forget
+
+echo x > a
+echo x > b
+echo x > c
+echo x > d
+
+hg add a b c d
+hg commit -m1
+
+echo % 00 state clean
+forget a
+
+echo % 01 state modified
+echo y >> b
+forget b
+
+echo % 02 state removed
+hg remove c
+forget c
+
+echo % 03 state missing
+rm d
+forget d
+
+echo % 04 state added
+echo x > e
+hg add e
+forget e
+
+echo % 05 state untracked
+echo x > f
+forget f
diff --git a/tests/test-forget.out b/tests/test-forget.out
new file mode 100644
--- /dev/null
+++ b/tests/test-forget.out
@@ -0,0 +1,94 @@
+% 00 state clean
+R a
+./a
+./b
+./c
+./d
+? a
+./a
+./b
+./c
+./d
+% 01 state modified
+M b
+? a
+R b
+? a
+./a
+./b
+./c
+./d
+? a
+? b
+./a
+./b
+./c
+./d
+% 02 state removed
+R c
+? a
+? b
+R c
+? a
+? b
+./a
+./b
+./d
+? a
+? b
+./a
+./b
+./d
+% 03 state missing
+! d
+? a
+? b
+R d
+? a
+? b
+./a
+./b
+? a
+? b
+./a
+./b
+% 04 state added
+A e
+? a
+? b
+? a
+? b
+? e
+./a
+./b
+./e
+nothing changed
+? a
+? b
+? e
+./a
+./b
+./e
+% 05 state untracked
+? a
+? b
+? e
+? f
+not removing f: file is already untracked
+? a
+? b
+? e
+? f
+./a
+./b
+./e
+./f
+nothing changed
+? a
+? b
+? e
+? f
+./a
+./b
+./e
+./f


More information about the Mercurial-devel mailing list