changeset 1236:67a28636ea64

Fix bug with co -C across branches, update tests
author mpm@selenic.com
date Tue, 13 Sep 2005 18:38:27 -0500
parents 5c0bd13bd771
children 227cfbe34109
files mercurial/localrepo.py tests/test-merge1 tests/test-merge1.out tests/test-revert-unknown tests/test-revert-unknown.out tests/test-update-reverse tests/test-update-reverse.out
diffstat 7 files changed, 135 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/localrepo.py	Tue Sep 13 14:23:43 2005 -0500
+++ b/mercurial/localrepo.py	Tue Sep 13 18:38:27 2005 -0500
@@ -1108,12 +1108,16 @@
                     self.ui.debug("other deleted %s\n" % f)
                     remove.append(f) # other deleted it
             else:
-                if n == m1.get(f, nullid): # same as parent
+                # file is created on branch or in working directory
+                if force and f not in umap:
+                    self.ui.debug("remote deleted %s, clobbering\n" % f)
+                    remove.append(f)
+                elif n == m1.get(f, nullid): # same as parent
                     if p2 == pa: # going backwards?
                         self.ui.debug("remote deleted %s\n" % f)
                         remove.append(f)
                     else:
-                        self.ui.debug("local created %s, keeping\n" % f)
+                        self.ui.debug("local modified %s, keeping\n" % f)
                 else:
                     self.ui.debug("working dir created %s, keeping\n" % f)
 
--- a/tests/test-merge1	Tue Sep 13 14:23:43 2005 -0500
+++ b/tests/test-merge1	Tue Sep 13 18:38:27 2005 -0500
@@ -21,8 +21,8 @@
 hg add c
 hg commit -m "commit #2" -d "0 0"
 echo This is file b1 > b
+echo %% no merges expected
 env HGMERGE=../merge hg update -m 1
-# no merges expected
 cd ..; /bin/rm -rf t
 
 mkdir t
@@ -40,9 +40,10 @@
 hg add c
 hg commit -m "commit #2" -d "0 0"
 echo This is file b2 > b
+echo %% merge of b expected
 env HGMERGE=../merge hg update -m 1
-# merge of b expected
 cd ..; /bin/rm -rf t
+echo %%
 
 mkdir t
 cd t
@@ -59,10 +60,13 @@
 echo This is file c1 > c
 hg add c
 hg commit -m "commit #3" -d "0 0"
+
+echo 'Contents of b should be "this is file b1"'
 cat b
+
 echo This is file b22 > b
+echo %% merge expected!
 env HGMERGE=../merge hg update -m 2
-# merge expected!
 cd ..; /bin/rm -rf t
 
 mkdir t
@@ -81,6 +85,6 @@
 hg add c
 hg commit -m "commit #3" -d "0 0"
 echo This is file b33 > b
+echo %% merge of b expected
 env HGMERGE=../merge hg update -m 2
-# merge of b expected
 cd ..; /bin/rm -rf t
--- a/tests/test-merge1.out	Tue Sep 13 14:23:43 2005 -0500
+++ b/tests/test-merge1.out	Tue Sep 13 18:38:27 2005 -0500
@@ -1,7 +1,13 @@
+%% no merges expected
+%% merge of b expected
 merging for b
 merging b
+%%
+Contents of b should be "this is file b1"
 This is file b1
+%% merge expected!
 merging for b
 merging b
+%% merge of b expected
 merging for b
 merging b
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-revert-unknown	Tue Sep 13 18:38:27 2005 -0500
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+hg init
+touch unknown
+
+touch a
+hg add a
+hg ci -m "1" -d "0 0"
+
+touch b
+hg add b
+hg ci -m "2" -d "0 0"
+
+echo %% Should show unknown
+hg status
+hg revert -r 0
+echo %% Should show unknown and b removed
+hg status
+echo %% Should show a and unknown
+ls
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-revert-unknown.out	Tue Sep 13 18:38:27 2005 -0500
@@ -0,0 +1,8 @@
+%% Should show unknown
+? unknown
+%% Should show unknown and b removed
+R b
+? unknown
+%% Should show a and unknown
+a
+unknown
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-update-reverse	Tue Sep 13 18:38:27 2005 -0500
@@ -0,0 +1,34 @@
+#!/bin/sh
+
+hg init
+touch a
+hg add a
+hg commit -m "Added a" -d "0 0"
+
+touch main
+hg add main
+hg commit -t "Added main" -d "0 0"
+hg checkout 0
+
+echo Main should be gone
+ls
+
+touch side1 
+hg add side1
+hg commit -m "Added side1" -d "0 0"
+touch side2
+hg add side2
+hg commit -m "Added side2" -d "0 0"
+
+hg log
+
+echo Should have two heads, side2 and main
+hg heads
+
+echo Should show "a side1 side2"
+ls
+
+hg update --debug -C 1
+echo Should only show "a main"
+ls
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-update-reverse.out	Tue Sep 13 18:38:27 2005 -0500
@@ -0,0 +1,53 @@
+Warning: -t and --text is deprecated, please use -m or --message instead.
+Main should be gone
+a
+changeset:   3:91ebc10ed028
+tag:         tip
+user:        test
+date:        Thu Jan  1 00:00:00 1970 +0000
+summary:     Added side2
+
+changeset:   2:b932d7dbb1e1
+parent:      0:c2eda428b523
+user:        test
+date:        Thu Jan  1 00:00:00 1970 +0000
+summary:     Added side1
+
+changeset:   1:71a760306caf
+user:        test
+date:        Thu Jan  1 00:00:00 1970 +0000
+summary:     Added main
+
+changeset:   0:c2eda428b523
+user:        test
+date:        Thu Jan  1 00:00:00 1970 +0000
+summary:     Added a
+
+Should have two heads, side2 and main
+changeset:   3:91ebc10ed028
+tag:         tip
+user:        test
+date:        Thu Jan  1 00:00:00 1970 +0000
+summary:     Added side2
+
+changeset:   1:71a760306caf
+user:        test
+date:        Thu Jan  1 00:00:00 1970 +0000
+summary:     Added main
+
+Should show a side1 side2
+a
+side1
+side2
+resolving manifests
+ force 1 allow None moddirstate True linear False
+ ancestor 8515d4bfda76 local 1c0f48f8ece6 remote 0594b9004bae
+remote deleted side2, clobbering
+remote deleted side1, clobbering
+remote created main
+getting main
+removing side1
+removing side2
+Should only show a main
+a
+main