[PATCH stable] mq: qpop: remove added files before re-adding removed files
Nicolas Dumazet
nicdumz at gmail.com
Fri Dec 11 00:33:43 CST 2009
# HG changeset patch
# User Nicolas Dumazet <nicdumz.commits at gmail.com>
# Date 1260511792 -32400
# Node ID 90a0630c2e79122a7a0a048b25939a7e50b3c151
# Parent 2b630e4c8f2f626f1e5d0f88646463968860f8ac
mq: qpop: remove added files before re-adding removed files
We need to do this to avoid file/directories conflicts.
This causes patches removing a committed file and replacing it
with a directory to be "unpoppable".
diff --git a/hgext/mq.py b/hgext/mq.py
--- a/hgext/mq.py
+++ b/hgext/mq.py
@@ -1096,12 +1096,6 @@
m, a, r, d = repo.status(qp, top)[:4]
if d:
raise util.Abort(_("deletions found between repo revs"))
- for f in m:
- getfile(f, mmap[f], mmap.flags(f))
- for f in r:
- getfile(f, mmap[f], mmap.flags(f))
- for f in m + r:
- repo.dirstate.normal(f)
for f in a:
try:
os.unlink(repo.wjoin(f))
@@ -1111,6 +1105,12 @@
try: os.removedirs(os.path.dirname(repo.wjoin(f)))
except: pass
repo.dirstate.forget(f)
+ for f in m:
+ getfile(f, mmap[f], mmap.flags(f))
+ for f in r:
+ getfile(f, mmap[f], mmap.flags(f))
+ for f in m + r:
+ repo.dirstate.normal(f)
repo.dirstate.setparents(qp, nullid)
for patch in reversed(self.applied[start:end]):
self.ui.status(_("popping %s\n") % patch.name)
diff --git a/tests/test-mq b/tests/test-mq
--- a/tests/test-mq
+++ b/tests/test-mq
@@ -561,3 +561,22 @@
hg qseries -v
hg up qparent
hg qpop
+
+cd ..
+hg init deletion-order
+cd deletion-order
+
+touch a
+hg ci -Aqm0
+
+hg qnew -DU rename-dir
+hg rm a
+
+mkdir a b
+touch a/a b/b
+hg -q add a b
+hg qref
+
+echo % test popping must remove files added in subdirectories first
+hg qpop
+cd ..
diff --git a/tests/test-mq.out b/tests/test-mq.out
--- a/tests/test-mq.out
+++ b/tests/test-mq.out
@@ -612,3 +612,6 @@
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
popping empty
patch queue now empty
+% test popping must remove files added in subdirectories first
+popping rename-dir
+patch queue now empty
More information about the Mercurial-devel
mailing list