update --clean: do not unlink added files (issue575)
authorBenoit Boissinot <benoit.boissinot@ens-lyon.org>
Tue, 19 May 2009 03:59:58 +0200
changeset 8518 3f4f14eab085
parent 8517 110763cc3ab0
child 8519 5fbee915ea5d
update --clean: do not unlink added files (issue575)
mercurial/merge.py
tests/test-keyword.out
tests/test-mq.out
tests/test-mv-cp-st-diff
tests/test-mv-cp-st-diff.out
tests/test-remove.out
tests/test-rename
tests/test-rename.out
tests/test-revert.out
tests/test-symlink-basic.out
tests/test-transplant
tests/test-transplant.out
--- a/mercurial/merge.py	Sun May 17 16:25:48 2009 +0200
+++ b/mercurial/merge.py	Tue May 19 03:59:58 2009 +0200
@@ -226,6 +226,8 @@
                 act("prompt keep", "a", f)
             else:
                 act("other deleted", "r", f)
+        elif overwrite and n[20:] == "a": # do not erase the working copy
+            act("remote deleted", "f", f)
         else:
             # file is created on branch or in working directory
             if (overwrite and n[20:] != "u") or (backwards and not n[20:]):
--- a/tests/test-keyword.out	Sun May 17 16:25:48 2009 +0200
+++ b/tests/test-keyword.out	Tue May 19 03:59:58 2009 +0200
@@ -253,7 +253,7 @@
 % status
 A c
 % update -C
-0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+0 files updated, 0 files merged, 0 files removed, 0 files unresolved
 % custom keyword expansion
 % try with kwdemo
 [extensions]
@@ -280,12 +280,14 @@
 abort: empty commit message
 % status
 M a
+? c
 ? log
 % commit
 a
 overwriting a expanding keywords
 committed changeset 2:bb948857c743469b22bbf51f7ec8112279ca5d83
 % status
+? c
 % verify
 checking changesets
 checking manifests
@@ -313,10 +315,12 @@
 % remove
 committed changeset 3:d14c712653769de926994cf7fbb06c8fbd68f012
 % status
+? c
 % rollback
 rolling back last transaction
 % status
 R a
+? c
 % revert a
 % cat a
 expand $Id: a bb948857c743 Thu, 01 Jan 1970 00:00:02 +0000 user $
--- a/tests/test-mq.out	Sun May 17 16:25:48 2009 +0200
+++ b/tests/test-mq.out	Tue May 19 03:59:58 2009 +0200
@@ -242,7 +242,7 @@
 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
 abort: local changes found
 % --force strip with local changes
-0 files updated, 0 files merged, 2 files removed, 0 files unresolved
+0 files updated, 0 files merged, 1 files removed, 0 files unresolved
 saving bundle to 
 % cd b; hg qrefresh
 adding a
--- a/tests/test-mv-cp-st-diff	Sun May 17 16:25:48 2009 +0200
+++ b/tests/test-mv-cp-st-diff	Tue May 19 03:59:58 2009 +0200
@@ -23,6 +23,7 @@
 add x/y y1
 hg add x/y
 hg ci -m2
+cd ..
 
 show()
 {
@@ -41,6 +42,7 @@
 # $4 - test description
 tb()
 {
+    hg clone t t2 ; cd t2
     hg co -q -C 0
 
     add a $count
@@ -62,6 +64,8 @@
     show "--rev 2 --rev ." "branch to parent"
     show "--rev . --rev 2" "parent to branch"
     echo
+    cd ..
+    rm -rf t2
 }
 
 
--- a/tests/test-mv-cp-st-diff.out	Sun May 17 16:25:48 2009 +0200
+++ b/tests/test-mv-cp-st-diff.out	Tue May 19 03:59:58 2009 +0200
@@ -1,3 +1,5 @@
+updating working directory
+3 files updated, 0 files merged, 0 files removed, 0 files unresolved
 created new head
 ** rename in working dir **
 ** add a a1 / add a a2 / hg mv a b
@@ -118,6 +120,8 @@
 +y1
 
 
+updating working directory
+3 files updated, 0 files merged, 0 files removed, 0 files unresolved
 created new head
 ** copy in working dir **
 ** add a a1 / add a a2 / hg cp a b
@@ -255,6 +259,8 @@
 +y1
 
 
+updating working directory
+3 files updated, 0 files merged, 0 files removed, 0 files unresolved
 created new head
 ** single rename **
 ** hg mv a b / add b b1 / add b w
@@ -390,6 +396,8 @@
 +y1
 
 
+updating working directory
+3 files updated, 0 files merged, 0 files removed, 0 files unresolved
 created new head
 ** single copy **
 ** hg cp a b / add b b1 / add a w
@@ -560,6 +568,8 @@
 +y1
 
 
+updating working directory
+3 files updated, 0 files merged, 0 files removed, 0 files unresolved
 created new head
 ** rename chain **
 ** hg mv a b / hg mv b c / hg mv c d
@@ -684,6 +694,8 @@
 +y1
 
 
+updating working directory
+3 files updated, 0 files merged, 0 files removed, 0 files unresolved
 created new head
 ** copy chain **
 ** hg cp a b / hg cp b c / hg cp c d
@@ -925,6 +937,8 @@
 +y1
 
 
+updating working directory
+3 files updated, 0 files merged, 0 files removed, 0 files unresolved
 created new head
 ** circular rename **
 ** add a a1 / hg mv a b / hg mv b a
@@ -1047,6 +1061,8 @@
 +y1
 
 
+updating working directory
+3 files updated, 0 files merged, 0 files removed, 0 files unresolved
 created new head
 moving x/x to y/x
 ** directory move **
--- a/tests/test-remove.out	Sun May 17 16:25:48 2009 +0200
+++ b/tests/test-remove.out	Tue May 19 03:59:58 2009 +0200
@@ -7,17 +7,23 @@
 A bar
 ./bar
 ./foo
-0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+0 files updated, 0 files merged, 0 files removed, 0 files unresolved
 % 01 state clean, options none
 R foo
+? bar
+./bar
 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
 % 02 state modified, options none
 not removing foo: file is modified (use -f to force removal)
 M foo
+? bar
+./bar
 ./foo
 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
 % 03 state missing, options none
 R foo
+? bar
+./bar
 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
 % 10 state added, options -f
 ? bar
@@ -38,18 +44,24 @@
 A bar
 ./bar
 ./foo
-0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+0 files updated, 0 files merged, 0 files removed, 0 files unresolved
 % 21 state clean, options -A
 not removing foo: file still exists (use -f to force removal)
+? bar
+./bar
 ./foo
 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
 % 22 state modified, options -A
 not removing foo: file still exists (use -f to force removal)
 M foo
+? bar
+./bar
 ./foo
 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
 % 23 state missing, options -A
 R foo
+? bar
+./bar
 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
 % 30 state added, options -Af
 ? bar
--- a/tests/test-rename	Sun May 17 16:25:48 2009 +0200
+++ b/tests/test-rename	Tue May 19 03:59:58 2009 +0200
@@ -14,65 +14,77 @@
 hg rename d1/d11/a1 d2/c
 hg status -C
 hg update -C
+rm d2/c
 
 echo "# rename --after a single file"
 mv d1/d11/a1 d2/c
 hg rename --after d1/d11/a1 d2/c
 hg status -C
 hg update -C
+rm d2/c
 
 echo "# move a single file to an existing directory"
 hg rename d1/d11/a1 d2
 hg status -C
 hg update -C
+rm d2/a1
 
 echo "# move --after a single file to an existing directory"
 mv d1/d11/a1 d2
 hg rename --after d1/d11/a1 d2
 hg status -C
 hg update -C
+rm d2/a1
 
 echo "# rename a file using a relative path"
 (cd d1/d11; hg rename ../../d2/b e)
 hg status -C
 hg update -C
+rm d1/d11/e
 
 echo "# rename --after a file using a relative path"
 (cd d1/d11; mv ../../d2/b e; hg rename --after ../../d2/b e)
 hg status -C
 hg update -C
+rm d1/d11/e
 
 echo "# rename directory d1 as d3"
 hg rename d1/ d3
 hg status -C
 hg update -C
+rm -rf d3
 
 echo "# rename --after directory d1 as d3"
 mv d1 d3
 hg rename --after d1 d3
 hg status -C
 hg update -C
+rm -rf d3
 
 echo "# move a directory using a relative path"
 (cd d2; mkdir d3; hg rename ../d1/d11 d3)
 hg status -C
 hg update -C
+rm -rf d2/d3
 
 echo "# move --after a directory using a relative path"
 (cd d2; mkdir d3; mv ../d1/d11 d3; hg rename --after ../d1/d11 d3)
 hg status -C
 hg update -C
+rm -rf d2/d3
 
 echo "# move directory d1/d11 to an existing directory d2 (removes empty d1)"
 hg rename d1/d11/ d2
 hg status -C
 hg update -C
+rm -rf d2/d11
 
 echo "# move directories d1 and d2 to a new directory d3"
 mkdir d3
 hg rename d1 d2 d3
 hg status -C
 hg update -C
+rm -rf d3
 
 echo "# move --after directories d1 and d2 to a new directory d3"
 mkdir d3
@@ -80,6 +92,7 @@
 hg rename --after d1 d2 d3
 hg status -C
 hg update -C
+rm -rf d3
 
 echo "# move everything under directory d1 to existing directory d2, do not"
 echo "# overwrite existing files (d2/b)"
@@ -87,6 +100,7 @@
 hg status -C
 diff d1/b d2/b
 hg update -C
+rm d2/a d2/ba d2/d11/a1
 
 echo "# attempt to move one file into a non-existent directory"
 hg rename d1/a dx/
@@ -102,6 +116,7 @@
 hg rename 'glob:d1/**' d2/d21
 hg status -C
 hg update -C
+rm -rf d2/d21
 
 echo "# move --after some files under d1 to d2/d21 (glob)"
 mkdir d2/d21
@@ -109,12 +124,14 @@
 hg rename --after 'glob:d1/**' d2/d21
 hg status -C
 hg update -C
+rm -rf d2/d21
 
 echo "# move every file under d1 starting with an 'a' to d2/d21 (regexp)"
 mkdir d2/d21
 hg rename 're:d1/([^a][^/]*/)*a.*' d2/d21
 hg status -C
 hg update -C
+rm -rf d2/d21
 
 echo "# attempt to overwrite an existing file"
 echo "ca" > d1/ca
@@ -127,24 +144,28 @@
 hg rename --force d1/ba d1/ca
 hg status -C
 hg update -C
+rm d1/ca
 
 echo "# replace a symlink with a file"
 ln -s ba d1/ca
 hg rename --force d1/ba d1/ca
 hg status -C
 hg update -C
+rm d1/ca
 
 echo "# do not copy more than one source file to the same destination file"
 mkdir d3
 hg rename d1/* d2/* d3
 hg status -C
 hg update -C
+rm -rf d3
 
 echo "# move a whole subtree with \"hg rename .\""
 mkdir d3
 (cd d1; hg rename . ../d3)
 hg status -C
 hg update -C
+rm -rf d3
 
 echo "# move a whole subtree with \"hg rename --after .\""
 mkdir d3
@@ -152,23 +173,27 @@
 (cd d1; hg rename --after . ../d3)
 hg status -C
 hg update -C
+rm -rf d3
 
 echo "# move the parent tree with \"hg rename ..\""
 (cd d1/d11; hg rename .. ../../d3)
 hg status -C
 hg update -C
+rm -rf d3
 
 echo "# skip removed files"
 hg remove d1/b
 hg rename d1 d3
 hg status -C
 hg update -C
+rm -rf d3
 
 echo "# transitive rename"
 hg rename d1/b d1/bb
 hg rename d1/bb d1/bc
 hg status -C
 hg update -C
+rm d1/bc
 
 echo "# transitive rename --after"
 hg rename d1/b d1/bb
@@ -176,6 +201,7 @@
 hg rename --after d1/bb d1/bc
 hg status -C
 hg update -C
+rm d1/bc
 
 echo "# idempotent renames (d1/b -> d1/bb followed by d1/bb -> d1/b)"
 hg rename d1/b d1/bb
--- a/tests/test-rename.out	Sun May 17 16:25:48 2009 +0200
+++ b/tests/test-rename.out	Tue May 19 03:59:58 2009 +0200
@@ -2,32 +2,32 @@
 A d2/c
   d1/d11/a1
 R d1/d11/a1
-1 files updated, 0 files merged, 1 files removed, 0 files unresolved
+1 files updated, 0 files merged, 0 files removed, 0 files unresolved
 # rename --after a single file
 A d2/c
   d1/d11/a1
 R d1/d11/a1
-1 files updated, 0 files merged, 1 files removed, 0 files unresolved
+1 files updated, 0 files merged, 0 files removed, 0 files unresolved
 # move a single file to an existing directory
 A d2/a1
   d1/d11/a1
 R d1/d11/a1
-1 files updated, 0 files merged, 1 files removed, 0 files unresolved
+1 files updated, 0 files merged, 0 files removed, 0 files unresolved
 # move --after a single file to an existing directory
 A d2/a1
   d1/d11/a1
 R d1/d11/a1
-1 files updated, 0 files merged, 1 files removed, 0 files unresolved
+1 files updated, 0 files merged, 0 files removed, 0 files unresolved
 # rename a file using a relative path
 A d1/d11/e
   d2/b
 R d2/b
-1 files updated, 0 files merged, 1 files removed, 0 files unresolved
+1 files updated, 0 files merged, 0 files removed, 0 files unresolved
 # rename --after a file using a relative path
 A d1/d11/e
   d2/b
 R d2/b
-1 files updated, 0 files merged, 1 files removed, 0 files unresolved
+1 files updated, 0 files merged, 0 files removed, 0 files unresolved
 # rename directory d1 as d3
 moving d1/a to d3/a
 moving d1/b to d3/b
@@ -45,7 +45,7 @@
 R d1/b
 R d1/ba
 R d1/d11/a1
-4 files updated, 0 files merged, 4 files removed, 0 files unresolved
+4 files updated, 0 files merged, 0 files removed, 0 files unresolved
 # rename --after directory d1 as d3
 moving d1/a to d3/a
 moving d1/b to d3/b
@@ -63,25 +63,25 @@
 R d1/b
 R d1/ba
 R d1/d11/a1
-4 files updated, 0 files merged, 4 files removed, 0 files unresolved
+4 files updated, 0 files merged, 0 files removed, 0 files unresolved
 # move a directory using a relative path
 moving ../d1/d11/a1 to d3/d11/a1
 A d2/d3/d11/a1
   d1/d11/a1
 R d1/d11/a1
-1 files updated, 0 files merged, 1 files removed, 0 files unresolved
+1 files updated, 0 files merged, 0 files removed, 0 files unresolved
 # move --after a directory using a relative path
 moving ../d1/d11/a1 to d3/d11/a1
 A d2/d3/d11/a1
   d1/d11/a1
 R d1/d11/a1
-1 files updated, 0 files merged, 1 files removed, 0 files unresolved
+1 files updated, 0 files merged, 0 files removed, 0 files unresolved
 # move directory d1/d11 to an existing directory d2 (removes empty d1)
 moving d1/d11/a1 to d2/d11/a1
 A d2/d11/a1
   d1/d11/a1
 R d1/d11/a1
-1 files updated, 0 files merged, 1 files removed, 0 files unresolved
+1 files updated, 0 files merged, 0 files removed, 0 files unresolved
 # move directories d1 and d2 to a new directory d3
 moving d1/a to d3/d1/a
 moving d1/b to d3/d1/b
@@ -103,7 +103,7 @@
 R d1/ba
 R d1/d11/a1
 R d2/b
-5 files updated, 0 files merged, 5 files removed, 0 files unresolved
+5 files updated, 0 files merged, 0 files removed, 0 files unresolved
 # move --after directories d1 and d2 to a new directory d3
 moving d1/a to d3/d1/a
 moving d1/b to d3/d1/b
@@ -125,7 +125,7 @@
 R d1/ba
 R d1/d11/a1
 R d2/b
-5 files updated, 0 files merged, 5 files removed, 0 files unresolved
+5 files updated, 0 files merged, 0 files removed, 0 files unresolved
 # move everything under directory d1 to existing directory d2, do not
 # overwrite existing files (d2/b)
 d2/b: not overwriting - file exists
@@ -143,7 +143,7 @@
 < d1/b
 ---
 > d2/b
-3 files updated, 0 files merged, 3 files removed, 0 files unresolved
+3 files updated, 0 files merged, 0 files removed, 0 files unresolved
 # attempt to move one file into a non-existent directory
 abort: destination dx/ is not a directory
 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
@@ -167,7 +167,7 @@
 R d1/b
 R d1/ba
 R d1/d11/a1
-4 files updated, 0 files merged, 4 files removed, 0 files unresolved
+4 files updated, 0 files merged, 0 files removed, 0 files unresolved
 # move --after some files under d1 to d2/d21 (glob)
 moving d1/a to d2/d21/a
 moving d1/d11/a1 to d2/d21/a1
@@ -177,7 +177,7 @@
   d1/d11/a1
 R d1/a
 R d1/d11/a1
-2 files updated, 0 files merged, 2 files removed, 0 files unresolved
+2 files updated, 0 files merged, 0 files removed, 0 files unresolved
 # move every file under d1 starting with an 'a' to d2/d21 (regexp)
 moving d1/a to d2/d21/a
 moving d1/d11/a1 to d2/d21/a1
@@ -187,7 +187,7 @@
   d1/d11/a1
 R d1/a
 R d1/d11/a1
-2 files updated, 0 files merged, 2 files removed, 0 files unresolved
+2 files updated, 0 files merged, 0 files removed, 0 files unresolved
 # attempt to overwrite an existing file
 d1/ca: not overwriting - file exists
 ? d1/ca
@@ -196,12 +196,12 @@
 A d1/ca
   d1/ba
 R d1/ba
-1 files updated, 0 files merged, 1 files removed, 0 files unresolved
+1 files updated, 0 files merged, 0 files removed, 0 files unresolved
 # replace a symlink with a file
 A d1/ca
   d1/ba
 R d1/ba
-1 files updated, 0 files merged, 1 files removed, 0 files unresolved
+1 files updated, 0 files merged, 0 files removed, 0 files unresolved
 # do not copy more than one source file to the same destination file
 moving d1/d11/a1 to d3/d11/a1
 d3/b: not overwriting - d2/b collides with d1/b
@@ -217,7 +217,7 @@
 R d1/b
 R d1/ba
 R d1/d11/a1
-4 files updated, 0 files merged, 4 files removed, 0 files unresolved
+4 files updated, 0 files merged, 0 files removed, 0 files unresolved
 # move a whole subtree with "hg rename ."
 moving a to ../d3/d1/a
 moving b to ../d3/d1/b
@@ -235,7 +235,7 @@
 R d1/b
 R d1/ba
 R d1/d11/a1
-4 files updated, 0 files merged, 4 files removed, 0 files unresolved
+4 files updated, 0 files merged, 0 files removed, 0 files unresolved
 # move a whole subtree with "hg rename --after ."
 moving a to ../d3/a
 moving b to ../d3/b
@@ -253,7 +253,7 @@
 R d1/b
 R d1/ba
 R d1/d11/a1
-4 files updated, 0 files merged, 4 files removed, 0 files unresolved
+4 files updated, 0 files merged, 0 files removed, 0 files unresolved
 # move the parent tree with "hg rename .."
 moving ../a to ../../d3/a
 moving ../b to ../../d3/b
@@ -271,7 +271,7 @@
 R d1/b
 R d1/ba
 R d1/d11/a1
-4 files updated, 0 files merged, 4 files removed, 0 files unresolved
+4 files updated, 0 files merged, 0 files removed, 0 files unresolved
 # skip removed files
 moving d1/a to d3/a
 moving d1/ba to d3/ba
@@ -286,17 +286,17 @@
 R d1/b
 R d1/ba
 R d1/d11/a1
-4 files updated, 0 files merged, 3 files removed, 0 files unresolved
+4 files updated, 0 files merged, 0 files removed, 0 files unresolved
 # transitive rename
 A d1/bc
   d1/b
 R d1/b
-1 files updated, 0 files merged, 1 files removed, 0 files unresolved
+1 files updated, 0 files merged, 0 files removed, 0 files unresolved
 # transitive rename --after
 A d1/bc
   d1/b
 R d1/b
-1 files updated, 0 files merged, 1 files removed, 0 files unresolved
+1 files updated, 0 files merged, 0 files removed, 0 files unresolved
 # idempotent renames (d1/b -> d1/bb followed by d1/bb -> d1/b)
 M d1/b
 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
--- a/tests/test-revert.out	Sun May 17 16:25:48 2009 +0200
+++ b/tests/test-revert.out	Tue May 19 03:59:58 2009 +0200
@@ -52,7 +52,7 @@
 R d
 %% should silently keep d removed
 R d
-1 files updated, 0 files merged, 1 files removed, 0 files unresolved
+1 files updated, 0 files merged, 0 files removed, 0 files unresolved
 reverting c
 %% should print non-executable
 non-executable
--- a/tests/test-symlink-basic.out	Sun May 17 16:25:48 2009 +0200
+++ b/tests/test-symlink-basic.out	Tue May 19 03:59:58 2009 +0200
@@ -28,4 +28,4 @@
 dangling -> void
 dangling2 -> void
 % issue995
-0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+0 files updated, 0 files merged, 0 files removed, 0 files unresolved
--- a/tests/test-transplant	Sun May 17 16:25:48 2009 +0200
+++ b/tests/test-transplant	Tue May 19 03:59:58 2009 +0200
@@ -92,6 +92,7 @@
 hg transplant 1:3
 # transplant -c shouldn't use an old changeset
 hg up -C
+rm added
 hg transplant 1
 hg transplant --continue
 hg transplant 1:3
--- a/tests/test-transplant.out	Sun May 17 16:25:48 2009 +0200
+++ b/tests/test-transplant.out	Tue May 19 03:59:58 2009 +0200
@@ -113,7 +113,7 @@
 1 out of 1 hunks FAILED -- saving rejects to file foo.rej
 patch failed to apply
 abort: Fix up the merge and run hg transplant --continue
-1 files updated, 0 files merged, 1 files removed, 0 files unresolved
+1 files updated, 0 files merged, 0 files removed, 0 files unresolved
 applying a1e30dd1b8e7
 patching file foo
 Hunk #1 FAILED at 0