changeset 6650:2c9565971abc

Merge with crew-stable
author Patrick Mezard <pmezard@gmail.com>
date Fri, 06 Jun 2008 18:31:57 +0200
parents 602f7c1ab954 (current diff) 05a682c8907d (diff)
children ffcf8e82f647
files hgext/mq.py
diffstat 3 files changed, 20 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/mq.py	Thu Jun 05 16:25:11 2008 +0200
+++ b/hgext/mq.py	Fri Jun 06 18:31:57 2008 +0200
@@ -2038,10 +2038,14 @@
     if r:
         wlock = r.wlock()
         try:
-            if r.dirstate[name] == 'r':
-                r.undelete([name])
-            r.copy(patch, name)
-            r.remove([patch], False)
+            if r.dirstate[patch] == 'a':
+                r.dirstate.forget(patch)
+                r.dirstate.add(name)
+            else:
+                if r.dirstate[name] == 'r':
+                    r.undelete([name])
+                r.copy(patch, name)
+                r.remove([patch], False)
         finally:
             del wlock
 
--- a/tests/test-mq-qrename	Thu Jun 05 16:25:11 2008 +0200
+++ b/tests/test-mq-qrename	Fri Jun 06 18:31:57 2008 +0200
@@ -22,4 +22,15 @@
 hg qrename bar/renamed baz
 hg qseries
 ls .hg/patches/baz
+cd ..
 
+echo % test patch being renamed before committed
+hg init b
+cd b
+hg qinit -c
+hg qnew x
+hg qrename y
+hg qcommit -m rename
+cd ..
+
+
--- a/tests/test-mq-qrename.out	Thu Jun 05 16:25:11 2008 +0200
+++ b/tests/test-mq-qrename.out	Fri Jun 06 18:31:57 2008 +0200
@@ -5,3 +5,4 @@
 renamed
 baz
 .hg/patches/baz
+% test patch being renamed before committed