changeset 14347:e8debe1eb255

mq: fix qpush changes detection of renamed files patch.changedfile() was not considering renamed file source as changed.
author Patrick Mezard <pmezard@gmail.com>
date Tue, 17 May 2011 23:27:58 +0200
parents bf85c2639700
children c1c719103392
files mercurial/patch.py tests/test-mq.t
diffstat 2 files changed, 21 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/patch.py	Mon May 16 16:59:45 2011 -0500
+++ b/mercurial/patch.py	Tue May 17 23:27:58 2011 +0200
@@ -1315,6 +1315,10 @@
                 for gp in values:
                     gp.path = pathstrip(gp.path, strip - 1)[1]
                     changed.add(gp.path)
+                    if gp.oldpath:
+                        gp.oldpath = pathstrip(gp.oldpath, strip - 1)[1]
+                        if gp.op == 'RENAME':
+                            changed.add(gp.oldpath)
             else:
                 raise util.Abort(_('unsupported parser state: %s') % state)
         return changed
--- a/tests/test-mq.t	Mon May 16 16:59:45 2011 -0500
+++ b/tests/test-mq.t	Tue May 17 23:27:58 2011 +0200
@@ -1299,6 +1299,23 @@
   popping foo
   patch queue now empty
   $ hg st
+
+related renamed source without change
+  $ hg qpush
+  applying foo
+  now at: foo
+  $ echo 1 > 1
+  $ hg mv 1 2
+  $ hg qref --git
+  $ hg qpop
+  popping foo
+  patch queue now empty
+  $ echo 3 > 1
+  $ hg st
+  M 1
+  $ hg qpush
+  abort: local changes found
+  [255]
   $ cd ..
 
 test qpush with --force, issue1087