Issue1255

Title hg qimport -f aborts, but overwrites anyway
Priority urgent Status resolved
Superseder Nosy List bernh, brendan, djc, dsp
Assigned To brendan Topics mq

Created on 2008-08-07.08:46:26 by djc, last changed 2008-11-04.07:40:49 by djc.

Messages
msg7835 (view) Author: djc Date: 2008-11-04.07:40:49
In main, resolving.
msg7550 (view) Author: brendan Date: 2008-10-19.00:39:47
I've applied a modified version, with test, in 1b7b21b634f2. I'm not sure what the 
right behaviour is when combined with -r
msg6766 (view) Author: djc Date: 2008-08-13.21:37:12
This is great, thanks! I'll look into polishing and providing a test.
msg6765 (view) Author: bernh Date: 2008-08-13.21:29:21
The following patch solves the Problem.
Unfortunately, I don't have time for polishing and proper testing during the
next weeks. Maybe somebody else likes to take this as a starting point...

diff --git a/hgext/mq.py b/hgext/mq.py
--- a/hgext/mq.py
+++ b/hgext/mq.py
@@ -1379,7 +1379,7 @@
     def qimport(self, repo, files, patchname=None, rev=None, existing=None,
                 force=None, git=False):
         def checkseries(patchname):
-            if patchname in self.series:
+            if not force and patchname in self.series:
                 raise util.Abort(_('patch %s is already in the series file')
                                  % patchname)
         def checkfile(patchname):
@@ -1480,8 +1480,9 @@
                 patchf = self.opener(patchname, "w")
                 patchf.write(text)
             checkseries(patchname)
-            index = self.full_series_end() + i
-            self.full_series[index:index] = [patchname]
+            if patchname not in self.series :
+                index = self.full_series_end() + i
+                self.full_series[index:index] = [patchname]
             self.parse_series()
             self.ui.warn("adding %s to series file\n" % patchname)
             i += 1
msg6737 (view) Author: djc Date: 2008-08-07.08:46:26
djc@darwin ~ $ hg init test
djc@darwin ~ $ cd test
djc@darwin test $ echo a > a
djc@darwin test $ hg add a
djc@darwin test $ hg qnew -f test1
djc@darwin test $ echo b > b
djc@darwin test $ hg add b
djc@darwin test $ hg diff
diff --git a/b b/b
new file mode 100644
--- /dev/null
+++ b/b
@@ -0,0 +1,1 @@
+b
djc@darwin test $ hg diff > test1
djc@darwin test $ rm b
djc@darwin test $ hg qimport -f test1
abort: patch test1 is already in the series file
djc@darwin test $ cat .hg/patches/test1
diff --git a/b b/b
new file mode 100644
--- /dev/null
+++ b/b
@@ -0,0 +1,1 @@
+b

So now the patch that was formerly in test1 is lost...
History
Date User Action Args
2008-11-04 07:40:49djcsetstatus: testing -> resolved
nosy: brendan, djc, bernh, dsp
messages: + msg7835
2008-11-02 14:06:12djcsetassignedto: djc -> brendan
nosy: brendan, djc, bernh, dsp
2008-10-19 00:39:47brendansetstatus: chatting -> testing
nosy: + brendan
messages: + msg7550
2008-08-30 10:55:28dspsetnosy: + dsp
2008-08-13 21:37:12djcsetmessages: + msg6766
2008-08-13 21:29:22bernhsetstatus: unread -> chatting
nosy: + bernh
messages: + msg6765
2008-08-07 08:46:53djcsettopic: + mq
2008-08-07 08:46:26djccreate