Show More
@@ -725,6 +725,8 b' class queue:' | |||||
725 | # 2) a unique substring of the patch name was given |
|
725 | # 2) a unique substring of the patch name was given | |
726 | # 3) patchname[-+]num to indicate an offset in the series file |
|
726 | # 3) patchname[-+]num to indicate an offset in the series file | |
727 | def lookup(self, patch, strict=False): |
|
727 | def lookup(self, patch, strict=False): | |
|
728 | patch = patch and str(patch) | |||
|
729 | ||||
728 | def partial_name(s): |
|
730 | def partial_name(s): | |
729 | if s in self.series: |
|
731 | if s in self.series: | |
730 | return s |
|
732 | return s | |
@@ -1750,19 +1752,36 b' def select(ui, repo, *args, **opts):' | |||||
1750 | when no guards active, patches with posative guards are skipped, |
|
1752 | when no guards active, patches with posative guards are skipped, | |
1751 | patches with nagative guards are pushed. |
|
1753 | patches with nagative guards are pushed. | |
1752 |
|
1754 | |||
|
1755 | qselect can change guards of applied patches. it does not pop | |||
|
1756 | guarded patches by default. use --pop to pop back to last applied | |||
|
1757 | patch that is not guarded. use --reapply (implies --pop) to push | |||
|
1758 | back to current patch afterwards, but skip guarded patches. | |||
|
1759 | ||||
1753 | use -s/--series to print list of all guards in series file (no |
|
1760 | use -s/--series to print list of all guards in series file (no | |
1754 | other arguments needed). use -v for more information.''' |
|
1761 | other arguments needed). use -v for more information.''' | |
1755 |
|
1762 | |||
1756 | q = repo.mq |
|
1763 | q = repo.mq | |
1757 | guards = q.active() |
|
1764 | guards = q.active() | |
1758 | if args or opts['none']: |
|
1765 | if args or opts['none']: | |
|
1766 | old_unapplied = q.unapplied(repo) | |||
|
1767 | old_guarded = [i for i in xrange(len(q.applied)) if | |||
|
1768 | not q.pushable(i)[0]] | |||
1759 | q.set_active(args) |
|
1769 | q.set_active(args) | |
1760 | q.save_dirty() |
|
1770 | q.save_dirty() | |
1761 | if not args: |
|
1771 | if not args: | |
1762 | ui.status(_('guards deactivated\n')) |
|
1772 | ui.status(_('guards deactivated\n')) | |
1763 | if q.series: |
|
1773 | if not opts['pop'] and not opts['reapply']: | |
1764 | ui.status(_('%d of %d unapplied patches active\n') % |
|
1774 | unapplied = q.unapplied(repo) | |
1765 | (len(q.unapplied(repo)), len(q.series))) |
|
1775 | guarded = [i for i in xrange(len(q.applied)) | |
|
1776 | if not q.pushable(i)[0]] | |||
|
1777 | if len(unapplied) != len(old_unapplied): | |||
|
1778 | ui.status(_('number of unguarded, unapplied patches has ' | |||
|
1779 | 'changed from %d to %d\n') % | |||
|
1780 | (len(old_unapplied), len(unapplied))) | |||
|
1781 | if len(guarded) != len(old_guarded): | |||
|
1782 | ui.status(_('number of guarded, applied patches has changed ' | |||
|
1783 | 'from %d to %d\n') % | |||
|
1784 | (len(old_guarded), len(guarded))) | |||
1766 | elif opts['series']: |
|
1785 | elif opts['series']: | |
1767 | guards = {} |
|
1786 | guards = {} | |
1768 | noguards = 0 |
|
1787 | noguards = 0 | |
@@ -1790,6 +1809,26 b' def select(ui, repo, *args, **opts):' | |||||
1790 | ui.write(g, '\n') |
|
1809 | ui.write(g, '\n') | |
1791 | else: |
|
1810 | else: | |
1792 | ui.write(_('no active guards\n')) |
|
1811 | ui.write(_('no active guards\n')) | |
|
1812 | reapply = opts['reapply'] and q.applied and q.appliedname(-1) | |||
|
1813 | popped = False | |||
|
1814 | if opts['pop'] or opts['reapply']: | |||
|
1815 | for i in xrange(len(q.applied)): | |||
|
1816 | pushable, reason = q.pushable(i) | |||
|
1817 | if not pushable: | |||
|
1818 | ui.status(_('popping guarded patches\n')) | |||
|
1819 | popped = True | |||
|
1820 | if i == 0: | |||
|
1821 | q.pop(repo, all=True) | |||
|
1822 | else: | |||
|
1823 | q.pop(repo, i-1) | |||
|
1824 | break | |||
|
1825 | if popped: | |||
|
1826 | try: | |||
|
1827 | if reapply: | |||
|
1828 | ui.status(_('reapplying unguarded patches\n')) | |||
|
1829 | q.push(repo, reapply) | |||
|
1830 | finally: | |||
|
1831 | q.save_dirty() | |||
1793 |
|
1832 | |||
1794 | def reposetup(ui, repo): |
|
1833 | def reposetup(ui, repo): | |
1795 | class mqrepo(repo.__class__): |
|
1834 | class mqrepo(repo.__class__): | |
@@ -1907,8 +1946,11 b' cmdtable = {' | |||||
1907 | 'hg qsave [-m TEXT] [-l FILE] [-c] [-n NAME] [-e] [-f]'), |
|
1946 | 'hg qsave [-m TEXT] [-l FILE] [-c] [-n NAME] [-e] [-f]'), | |
1908 | "qselect": (select, |
|
1947 | "qselect": (select, | |
1909 | [('n', 'none', None, _('disable all guards')), |
|
1948 | [('n', 'none', None, _('disable all guards')), | |
1910 |
('s', 'series', None, _('list all guards in series file')) |
|
1949 | ('s', 'series', None, _('list all guards in series file')), | |
1911 | 'hg qselect [GUARDS]'), |
|
1950 | ('', 'pop', None, | |
|
1951 | _('pop to before first guarded applied patch')), | |||
|
1952 | ('', 'reapply', None, _('pop, then reapply patches'))], | |||
|
1953 | 'hg qselect [OPTION...] [GUARD...]'), | |||
1912 | "qseries": |
|
1954 | "qseries": | |
1913 | (series, |
|
1955 | (series, | |
1914 | [('m', 'missing', None, 'print patches not in series'), |
|
1956 | [('m', 'missing', None, 'print patches not in series'), |
@@ -82,3 +82,6 b' hg qguard a.patch +1 +2 -3' | |||||
82 | hg qselect 1 2 3 |
|
82 | hg qselect 1 2 3 | |
83 | echo % should push b.patch |
|
83 | echo % should push b.patch | |
84 | hg qpush |
|
84 | hg qpush | |
|
85 | ||||
|
86 | hg qpush -a | |||
|
87 | hg qselect -n --reapply |
@@ -13,7 +13,7 b' a.patch: +a' | |||||
13 | applying b.patch |
|
13 | applying b.patch | |
14 | Now at: b.patch |
|
14 | Now at: b.patch | |
15 | Patch queue now empty |
|
15 | Patch queue now empty | |
16 | 3 of 3 unapplied patches active |
|
16 | number of unguarded, unapplied patches has changed from 2 to 3 | |
17 | % should push a.patch |
|
17 | % should push a.patch | |
18 | applying a.patch |
|
18 | applying a.patch | |
19 | Now at: a.patch |
|
19 | Now at: a.patch | |
@@ -28,27 +28,34 b' applying c.patch' | |||||
28 | Now at: c.patch |
|
28 | Now at: c.patch | |
29 | Patch queue now empty |
|
29 | Patch queue now empty | |
30 | guards deactivated |
|
30 | guards deactivated | |
31 | 2 of 3 unapplied patches active |
|
31 | number of unguarded, unapplied patches has changed from 3 to 2 | |
32 | % should push all |
|
32 | % should push all | |
33 | applying b.patch |
|
33 | applying b.patch | |
34 | applying c.patch |
|
34 | applying c.patch | |
35 | Now at: c.patch |
|
35 | Now at: c.patch | |
36 | Patch queue now empty |
|
36 | Patch queue now empty | |
37 | 2 of 3 unapplied patches active |
|
|||
38 | % should push b.patch |
|
37 | % should push b.patch | |
39 | applying b.patch |
|
38 | applying b.patch | |
40 | Now at: b.patch |
|
39 | Now at: b.patch | |
41 | Patch queue now empty |
|
40 | Patch queue now empty | |
42 | 2 of 3 unapplied patches active |
|
|||
43 | applying b.patch |
|
41 | applying b.patch | |
44 | Now at: b.patch |
|
42 | Now at: b.patch | |
45 | Patch queue now empty |
|
43 | Patch queue now empty | |
46 | 3 of 3 unapplied patches active |
|
44 | number of unguarded, unapplied patches has changed from 2 to 3 | |
47 | % should push a.patch |
|
45 | % should push a.patch | |
48 | applying a.patch |
|
46 | applying a.patch | |
49 | Now at: a.patch |
|
47 | Now at: a.patch | |
50 | Patch queue now empty |
|
48 | Patch queue now empty | |
51 | 2 of 3 unapplied patches active |
|
49 | number of unguarded, unapplied patches has changed from 3 to 2 | |
52 | % should push b.patch |
|
50 | % should push b.patch | |
53 | applying b.patch |
|
51 | applying b.patch | |
54 | Now at: b.patch |
|
52 | Now at: b.patch | |
|
53 | applying c.patch | |||
|
54 | Now at: c.patch | |||
|
55 | guards deactivated | |||
|
56 | popping guarded patches | |||
|
57 | Patch queue now empty | |||
|
58 | reapplying unguarded patches | |||
|
59 | applying b.patch | |||
|
60 | applying c.patch | |||
|
61 | Now at: c.patch |
General Comments 0
You need to be logged in to leave comments.
Login now