merge: require --force when there are deleted files
authorAlexis S. L. Carvalho <alexis@cecm.usp.br>
Fri, 14 Mar 2008 09:56:58 -0300
changeset 6256 69c75d063c7a
parent 6255 ae83d927c629
child 6257 bfd49ce0db64
merge: require --force when there are deleted files
mercurial/merge.py
tests/test-merge-force
tests/test-merge-force.out
--- a/mercurial/merge.py	Fri Mar 14 09:56:58 2008 -0300
+++ b/mercurial/merge.py	Fri Mar 14 09:56:58 2008 -0300
@@ -609,7 +609,7 @@
             raise util.Abort(_("update spans branches, use 'hg merge' "
                                "or 'hg update -C' to lose changes"))
         if branchmerge and not forcemerge:
-            if wc.files():
+            if wc.files() or wc.deleted():
                 raise util.Abort(_("outstanding uncommitted changes"))
 
         ### calculate phase
--- a/tests/test-merge-force	Fri Mar 14 09:56:58 2008 -0300
+++ b/tests/test-merge-force	Fri Mar 14 09:56:58 2008 -0300
@@ -17,7 +17,8 @@
 rm a
 
 echo '% local deleted a file, remote removed'
-hg -v merge
+hg merge # should fail, since there are deleted files
+hg -v merge --force
 echo % should show a as removed
 hg st
 
--- a/tests/test-merge-force.out	Fri Mar 14 09:56:58 2008 -0300
+++ b/tests/test-merge-force.out	Fri Mar 14 09:56:58 2008 -0300
@@ -1,4 +1,5 @@
 % local deleted a file, remote removed
+abort: outstanding uncommitted changes
 resolving manifests
 removing a
 0 files updated, 0 files merged, 1 files removed, 0 files unresolved