fetch: don't proceed if working directory is missing files (issue988)
authorBryan O'Sullivan <bos@serpentine.com>
Tue, 11 Mar 2008 11:38:12 -0700
changeset 6226 bd61e44eb2cc
parent 6225 595a69a01129
child 6227 4c1aa6affe60
child 6231 5e5ce714ba95
fetch: don't proceed if working directory is missing files (issue988)
hgext/fetch.py
tests/test-fetch
tests/test-fetch.out
--- a/hgext/fetch.py	Tue Mar 11 11:30:42 2008 -0700
+++ b/hgext/fetch.py	Tue Mar 11 11:38:12 2008 -0700
@@ -103,9 +103,11 @@
     try:
         wlock = repo.wlock()
         lock = repo.lock()
-        mod, add, rem = repo.status()[:3]
+        mod, add, rem, del_ = repo.status()[:4]
         if mod or add or rem:
             raise util.Abort(_('outstanding uncommitted changes'))
+        if del_:
+            raise util.Abort(_('working directory is missing some files'))
         if len(repo.heads()) > 1:
             raise util.Abort(_('multiple heads in this repository '
                                '(use "hg heads" and "hg merge" to merge)'))
--- a/tests/test-fetch	Tue Mar 11 11:30:42 2008 -0700
+++ b/tests/test-fetch	Tue Mar 11 11:38:12 2008 -0700
@@ -52,5 +52,12 @@
 echo g > g/g
 hg --cwd g ci -d '6 0' -Amg
 
+hg clone -q f h
+hg clone -q g i
+
 echo % should merge f into g
 hg --cwd g fetch -d '7 0' --switch -m 'automated merge' ../f
+
+rm i/g
+echo % should abort, because i is modified
+hg --cwd i fetch ../h
--- a/tests/test-fetch.out	Tue Mar 11 11:30:42 2008 -0700
+++ b/tests/test-fetch.out	Tue Mar 11 11:38:12 2008 -0700
@@ -71,3 +71,5 @@
 merging with 3:cc6a3744834d
 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
 new changeset 4:55aa4f32ec59 merges remote changes with local
+% should abort, because i is modified
+abort: working directory is missing some files