Mercurial > hg-stable
changeset 7160:1b7b21b634f2
mq: make qimport -f work properly. Closes issue1255.
From Bernhard Leiner.
author | Brendan Cully <brendan@kublai.com> |
---|---|
date | Sat, 18 Oct 2008 17:29:45 -0700 |
parents | a634e0065295 |
children | b420ef2c812b |
files | hgext/mq.py tests/test-mq-qimport tests/test-mq-qimport.out |
diffstat | 3 files changed, 33 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/mq.py Sat Oct 18 16:53:44 2008 -0700 +++ b/hgext/mq.py Sat Oct 18 17:29:45 2008 -0700 @@ -1511,9 +1511,11 @@ checkfile(patchname) patchf = self.opener(patchname, "w") patchf.write(text) - checkseries(patchname) - index = self.full_series_end() + i - self.full_series[index:index] = [patchname] + if not force: + checkseries(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
--- a/tests/test-mq-qimport Sat Oct 18 16:53:44 2008 -0700 +++ b/tests/test-mq-qimport Sat Oct 18 17:29:45 2008 -0700 @@ -36,6 +36,22 @@ hg qimport file://$HGTMP/url.diff hg qun +echo % import patch that already exists +echo foo2 >> foo +hg add foo +hg diff > ../url.diff +hg revert --no-backup foo +rm foo +hg qimport ../url.diff +hg qpush +cat foo +hg qpop +echo % qimport -f +hg qimport -f ../url.diff +hg qpush +cat foo +hg qpop + echo % build diff with CRLF python ../writelines.py b 5 'a\n' 5 'a\r\n' hg ci -Am addb
--- a/tests/test-mq-qimport.out Sat Oct 18 16:53:44 2008 -0700 +++ b/tests/test-mq-qimport.out Sat Oct 18 17:29:45 2008 -0700 @@ -3,6 +3,18 @@ % import URL adding url.diff to series file url.diff +% import patch that already exists +abort: patch "url.diff" already exists +applying url.diff +Now at: url.diff +foo +Patch queue now empty +% qimport -f +adding url.diff to series file +applying url.diff +Now at: url.diff +foo2 +Patch queue now empty % build diff with CRLF adding b 1 files updated, 0 files merged, 0 files removed, 0 files unresolved