mq: fix qrefresh losing copy information (issue 1134)
authorPatrick Mezard <pmezard@gmail.com>
Mon, 07 Jul 2008 09:16:09 +0200
changeset 6801 71e339714586
parent 6791 bbd89c9e6012
child 6802 04503b757935
child 6813 e1d8e79d7c8f
mq: fix qrefresh losing copy information (issue 1134)
hgext/mq.py
tests/test-mq-qrefresh
tests/test-mq-qrefresh.out
--- a/hgext/mq.py	Wed Jun 25 14:13:20 2008 -0700
+++ b/hgext/mq.py	Mon Jul 07 09:16:09 2008 +0200
@@ -1106,7 +1106,7 @@
                         f = repo.file(dst)
                         src = f.renamed(man[dst])
                         if src:
-                            copies[src[0]] = copies.get(dst, [])
+                            copies.setdefault(src[0], []).extend(copies.get(dst, []))
                             if dst in a:
                                 copies[src[0]].append(dst)
                         # we can't copy a file created by the patch itself
--- a/tests/test-mq-qrefresh	Wed Jun 25 14:13:20 2008 -0700
+++ b/tests/test-mq-qrefresh	Mon Jul 07 09:16:09 2008 +0200
@@ -82,3 +82,28 @@
 cat .hg/patches/mqbase | \
 sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
     -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/"
+cd ..
+
+
+
+echo "[diff]" >> $HGRCPATH
+echo "git=True" >> $HGRCPATH
+
+# Test qrefresh --git losing copy metadata
+echo % create test repo
+hg init repo
+cd repo
+echo a > a
+hg ci -Am adda
+hg copy a ab
+echo b >> ab
+hg copy a ac
+echo c >> ac
+echo % capture changes
+hg qnew -f p1
+hg qdiff
+echo % refresh and check changes again
+hg qref
+hg qdiff
+cd ..
+
--- a/tests/test-mq-qrefresh.out	Wed Jun 25 14:13:20 2008 -0700
+++ b/tests/test-mq-qrefresh.out	Mon Jul 07 09:16:09 2008 +0200
@@ -159,3 +159,39 @@
 @@ -1,1 +1,1 @@
 -base
 +patched
+% create test repo
+adding a
+% capture changes
+diff --git a/a b/ab
+copy from a
+copy to ab
+--- a/a
++++ b/ab
+@@ -1,1 +1,2 @@
+ a
++b
+diff --git a/a b/ac
+copy from a
+copy to ac
+--- a/a
++++ b/ac
+@@ -1,1 +1,2 @@
+ a
++c
+% refresh and check changes again
+diff --git a/a b/ab
+copy from a
+copy to ab
+--- a/a
++++ b/ab
+@@ -1,1 +1,2 @@
+ a
++b
+diff --git a/a b/ac
+copy from a
+copy to ac
+--- a/a
++++ b/ac
+@@ -1,1 +1,2 @@
+ a
++c