Show More
@@ -0,0 +1,33 b'' | |||||
|
1 | #!/bin/sh | |||
|
2 | #failed qimport of patches from files should cleanup by recording successfully | |||
|
3 | #imported patches in series file. | |||
|
4 | ||||
|
5 | echo "[extensions]" >> $HGRCPATH | |||
|
6 | echo "mq=" >> $HGRCPATH | |||
|
7 | ||||
|
8 | hg init repo | |||
|
9 | cd repo | |||
|
10 | ||||
|
11 | echo a > a | |||
|
12 | hg ci -Am'add a' | |||
|
13 | ||||
|
14 | cat >b.patch<<EOF | |||
|
15 | diff --git a/a b/a | |||
|
16 | --- a/a | |||
|
17 | +++ b/a | |||
|
18 | @@ -1,1 +1,2 @@ | |||
|
19 | a | |||
|
20 | +b | |||
|
21 | EOF | |||
|
22 | ||||
|
23 | echo | |||
|
24 | echo '#empty series' | |||
|
25 | hg qseries | |||
|
26 | ||||
|
27 | echo | |||
|
28 | echo '#qimport valid patch followed by invalid patch' | |||
|
29 | hg qimport b.patch fakepatch | |||
|
30 | ||||
|
31 | echo | |||
|
32 | echo '#valid patches before fail added to series' | |||
|
33 | hg qseries |
@@ -0,0 +1,10 b'' | |||||
|
1 | adding a | |||
|
2 | ||||
|
3 | #empty series | |||
|
4 | ||||
|
5 | #qimport valid patch followed by invalid patch | |||
|
6 | adding b.patch to series file | |||
|
7 | abort: unable to read fakepatch | |||
|
8 | ||||
|
9 | #valid patches before fail added to series | |||
|
10 | b.patch |
@@ -250,6 +250,7 b' class queue(object):' | |||||
250 | self.ui = ui |
|
250 | self.ui = ui | |
251 | self.applied_dirty = 0 |
|
251 | self.applied_dirty = 0 | |
252 | self.series_dirty = 0 |
|
252 | self.series_dirty = 0 | |
|
253 | self.added = [] | |||
253 | self.series_path = "series" |
|
254 | self.series_path = "series" | |
254 | self.status_path = "status" |
|
255 | self.status_path = "status" | |
255 | self.guards_path = "guards" |
|
256 | self.guards_path = "guards" | |
@@ -1622,7 +1623,7 b' class queue(object):' | |||||
1622 | if (len(files) > 1 or len(rev) > 1) and patchname: |
|
1623 | if (len(files) > 1 or len(rev) > 1) and patchname: | |
1623 | raise util.Abort(_('option "-n" not valid when importing multiple ' |
|
1624 | raise util.Abort(_('option "-n" not valid when importing multiple ' | |
1624 | 'patches')) |
|
1625 | 'patches')) | |
1625 | added = [] |
|
1626 | self.added = [] | |
1626 | if rev: |
|
1627 | if rev: | |
1627 | # If mq patches are applied, we can only import revisions |
|
1628 | # If mq patches are applied, we can only import revisions | |
1628 | # that form a linear path to qbase. |
|
1629 | # that form a linear path to qbase. | |
@@ -1672,10 +1673,11 b' class queue(object):' | |||||
1672 | se = statusentry(n, patchname) |
|
1673 | se = statusentry(n, patchname) | |
1673 | self.applied.insert(0, se) |
|
1674 | self.applied.insert(0, se) | |
1674 |
|
1675 | |||
1675 | added.append(patchname) |
|
1676 | self.added.append(patchname) | |
1676 | patchname = None |
|
1677 | patchname = None | |
1677 | self.parse_series() |
|
1678 | self.parse_series() | |
1678 | self.applied_dirty = 1 |
|
1679 | self.applied_dirty = 1 | |
|
1680 | self.series_dirty = True | |||
1679 |
|
1681 | |||
1680 | for i, filename in enumerate(files): |
|
1682 | for i, filename in enumerate(files): | |
1681 | if existing: |
|
1683 | if existing: | |
@@ -1709,13 +1711,10 b' class queue(object):' | |||||
1709 | index = self.full_series_end() + i |
|
1711 | index = self.full_series_end() + i | |
1710 | self.full_series[index:index] = [patchname] |
|
1712 | self.full_series[index:index] = [patchname] | |
1711 | self.parse_series() |
|
1713 | self.parse_series() | |
|
1714 | self.series_dirty = True | |||
1712 | self.ui.warn(_("adding %s to series file\n") % patchname) |
|
1715 | self.ui.warn(_("adding %s to series file\n") % patchname) | |
1713 | added.append(patchname) |
|
1716 | self.added.append(patchname) | |
1714 | patchname = None |
|
1717 | patchname = None | |
1715 | self.series_dirty = 1 |
|
|||
1716 | qrepo = self.qrepo() |
|
|||
1717 | if qrepo: |
|
|||
1718 | qrepo[None].add(added) |
|
|||
1719 |
|
1718 | |||
1720 | def delete(ui, repo, *patches, **opts): |
|
1719 | def delete(ui, repo, *patches, **opts): | |
1721 | """remove patches from queue |
|
1720 | """remove patches from queue | |
@@ -1805,10 +1804,15 b' def qimport(ui, repo, *filename, **opts)' | |||||
1805 | using the --name flag. |
|
1804 | using the --name flag. | |
1806 | """ |
|
1805 | """ | |
1807 | q = repo.mq |
|
1806 | q = repo.mq | |
|
1807 | try: | |||
1808 | q.qimport(repo, filename, patchname=opts['name'], |
|
1808 | q.qimport(repo, filename, patchname=opts['name'], | |
1809 | existing=opts['existing'], force=opts['force'], rev=opts['rev'], |
|
1809 | existing=opts['existing'], force=opts['force'], rev=opts['rev'], | |
1810 | git=opts['git']) |
|
1810 | git=opts['git']) | |
|
1811 | finally: | |||
1811 | q.save_dirty() |
|
1812 | q.save_dirty() | |
|
1813 | qrepo = q.qrepo() | |||
|
1814 | if qrepo: | |||
|
1815 | qrepo[None].add(q.added) | |||
1812 |
|
1816 | |||
1813 | if opts.get('push') and not opts.get('rev'): |
|
1817 | if opts.get('push') and not opts.get('rev'): | |
1814 | return q.push(repo, None) |
|
1818 | return q.push(repo, None) |
General Comments 0
You need to be logged in to leave comments.
Login now