tiny bug: conflict of qcommit and qrename

Weijun Wang Weijun.Wang at Sun.COM
Tue Jun 3 22:51:58 CDT 2008


Inside an empty directory, run these commands:

   hg init; hg qinit -c; hg qnew x; hg qrename y; hg qcommit

and there's an error. The reason is that after "hg qnew x" there's a "hg
add x" called inside the q repo. However, after the qrename, the patch
file name is changed and qcommit cannot find it.

I have a patch for it:

--- a/hgext/mq.py	Wed Jun 04 11:22:08 2008 +0800
+++ b/hgext/mq.py	Wed Jun 04 11:51:01 2008 +0800
@@ -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


Max


More information about the Mercurial mailing list