diff tests/test-issue660 @ 5487:7a64931e2d76

Fix file-changed-to-dir and dir-to-file commits (issue660). Allow adding to dirstate files that clash with previously existing but marked for removal. Protect from reintroducing clashes by revert. This change doesn't address related issues with update. Current workaround is to do "clean" update by manually removing conflicting files/dirs from working directory.
author Maxim Dounin <mdounin@mdounin.ru>
date Mon, 05 Nov 2007 20:05:44 +0300
parents
children f252ba975925
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-issue660	Mon Nov 05 20:05:44 2007 +0300
@@ -0,0 +1,89 @@
+#!/bin/sh
+# http://www.selenic.com/mercurial/bts/issue660
+
+
+hg init a
+cd a
+echo a > a
+mkdir b
+echo b > b/b
+hg commit -A -m "a is file, b is dir"
+
+echo % file replaced with directory
+
+rm a
+mkdir a
+echo a > a/a
+
+echo % should fail - would corrupt dirstate
+hg add a/a 
+
+echo % removing shadow
+hg rm --after a
+
+echo % should succeed - shadow removed
+hg add a/a
+
+echo % directory replaced with file
+
+rm -r b
+echo b > b
+
+echo % should fail - would corrupt dirstate
+hg add b
+
+echo % removing shadow
+hg rm --after b/b
+
+echo % should succeed - shadow removed
+hg add b
+
+echo % look what we got
+hg st
+
+echo % revert reintroducing shadow - should fail
+rm -r a b
+hg revert b/b
+
+echo % revert all - should succeed
+hg revert --all
+hg st
+
+echo % addremove
+
+rm -r a b
+mkdir a
+echo a > a/a
+echo b > b
+
+hg addremove
+hg st
+
+echo % commit
+hg ci -A -m "a is dir, b is file"
+hg st --all
+
+echo % long directory replaced with file
+
+mkdir d
+mkdir d/d
+echo d > d/d/d
+hg commit -A -m "d is long directory"
+rm -r d
+echo d > d
+
+echo % should fail - would corrupt dirstate
+hg add d
+
+echo % removing shadow
+hg rm --after d/d/d
+
+echo % should succeed - shadow removed
+hg add d
+
+#echo % update should work
+#
+#hg up -r 0
+#hg up -r 1
+
+exit 0