Show More
@@ -1682,17 +1682,35 b' def delete(ui, repo, *patches, **opts):' | |||
|
1682 | 1682 | |
|
1683 | 1683 | def applied(ui, repo, patch=None, **opts): |
|
1684 | 1684 | """print the patches already applied""" |
|
1685 | ||
|
1685 | 1686 | q = repo.mq |
|
1687 | l = len(q.applied) | |
|
1688 | ||
|
1686 | 1689 | if patch: |
|
1687 | 1690 | if patch not in q.series: |
|
1688 | 1691 | raise util.Abort(_("patch %s is not in series file") % patch) |
|
1689 | 1692 | end = q.series.index(patch) + 1 |
|
1690 | 1693 | else: |
|
1691 | 1694 | end = q.series_end(True) |
|
1692 | return q.qseries(repo, length=end, status='A', summary=opts.get('summary')) | |
|
1695 | ||
|
1696 | if opts.get('last') and not end: | |
|
1697 | ui.write(_("no patches applied\n")) | |
|
1698 | return 1 | |
|
1699 | elif opts.get('last') and end == 1: | |
|
1700 | ui.write(_("only one patch applied\n")) | |
|
1701 | return 1 | |
|
1702 | elif opts.get('last'): | |
|
1703 | start = end - 2 | |
|
1704 | end = 1 | |
|
1705 | else: | |
|
1706 | start = 0 | |
|
1707 | ||
|
1708 | return q.qseries(repo, length=end, start=start, status='A', | |
|
1709 | summary=opts.get('summary')) | |
|
1693 | 1710 | |
|
1694 | 1711 | def unapplied(ui, repo, patch=None, **opts): |
|
1695 | 1712 | """print the patches not yet applied""" |
|
1713 | ||
|
1696 | 1714 | q = repo.mq |
|
1697 | 1715 | if patch: |
|
1698 | 1716 | if patch not in q.series: |
@@ -1700,7 +1718,14 b' def unapplied(ui, repo, patch=None, **op' | |||
|
1700 | 1718 | start = q.series.index(patch) + 1 |
|
1701 | 1719 | else: |
|
1702 | 1720 | start = q.series_end(True) |
|
1703 | q.qseries(repo, start=start, status='U', summary=opts.get('summary')) | |
|
1721 | ||
|
1722 | if start == len(q.series) and opts.get('first'): | |
|
1723 | ui.write(_("all patches applied\n")) | |
|
1724 | return 1 | |
|
1725 | ||
|
1726 | length = opts.get('first') and 1 or None | |
|
1727 | return q.qseries(repo, start=start, length=length, status='U', | |
|
1728 | summary=opts.get('summary')) | |
|
1704 | 1729 | |
|
1705 | 1730 | def qimport(ui, repo, *filename, **opts): |
|
1706 | 1731 | """import a patch |
@@ -2522,7 +2547,10 b' def uisetup(ui):' | |||
|
2522 | 2547 | seriesopts = [('s', 'summary', None, _('print first line of patch header'))] |
|
2523 | 2548 | |
|
2524 | 2549 | cmdtable = { |
|
2525 | "qapplied": (applied, [] + seriesopts, _('hg qapplied [-s] [PATCH]')), | |
|
2550 | "qapplied": | |
|
2551 | (applied, | |
|
2552 | [('1', 'last', None, _('show only the last patch'))] + seriesopts, | |
|
2553 | _('hg qapplied [-s] [PATCH]')), | |
|
2526 | 2554 | "qclone": |
|
2527 | 2555 | (clone, |
|
2528 | 2556 | [('', 'pull', None, _('use pull protocol to copy metadata')), |
@@ -2645,7 +2673,10 b' cmdtable = {' | |||
|
2645 | 2673 | ('n', 'nobackup', None, _('no backups'))], |
|
2646 | 2674 | _('hg strip [-f] [-b] [-n] REV')), |
|
2647 | 2675 | "qtop": (top, [] + seriesopts, _('hg qtop [-s]')), |
|
2648 | "qunapplied": (unapplied, [] + seriesopts, _('hg qunapplied [-s] [PATCH]')), | |
|
2676 | "qunapplied": | |
|
2677 | (unapplied, | |
|
2678 | [('1', 'first', None, _('show only the first patch'))] + seriesopts, | |
|
2679 | _('hg qunapplied [-s] [PATCH]')), | |
|
2649 | 2680 | "qfinish": |
|
2650 | 2681 | (finish, |
|
2651 | 2682 | [('a', 'applied', None, _('finish all applied changesets'))], |
@@ -155,18 +155,13 b' hg qapplied' | |||
|
155 | 155 | echo % qtop |
|
156 | 156 | hg qtop |
|
157 | 157 | |
|
158 |
echo % |
|
|
159 | hg qprev | |
|
160 | ||
|
161 | echo % qnext | |
|
162 | hg qnext | |
|
158 | echo % prev | |
|
159 | hg qapp -1 | |
|
163 | 160 | |
|
164 | echo % pop, qnext, qprev, qapplied | |
|
161 | echo % next | |
|
162 | hg qunapp -1 | |
|
163 | ||
|
165 | 164 | hg qpop |
|
166 | hg qnext | |
|
167 | hg qprev | |
|
168 | hg qapplied | |
|
169 | ||
|
170 | 165 | echo % commit should fail |
|
171 | 166 | hg commit |
|
172 | 167 | |
@@ -197,6 +192,42 b' hg qpop test2.patch-1' | |||
|
197 | 192 | hg qpop test2.patch-2 |
|
198 | 193 | hg qpush test1b.patch+1 |
|
199 | 194 | |
|
195 | echo % pop, qapplied, qunapplied | |
|
196 | hg qseries -v | |
|
197 | echo % qapplied -1 test.patch | |
|
198 | hg qapplied -1 test.patch | |
|
199 | echo % qapplied -1 test1b.patch | |
|
200 | hg qapplied -1 test1b.patch | |
|
201 | echo % qapplied -1 test2.patch | |
|
202 | hg qapplied -1 test2.patch | |
|
203 | echo % qapplied -1 | |
|
204 | hg qapplied -1 | |
|
205 | echo % qapplied | |
|
206 | hg qapplied | |
|
207 | echo % qapplied test1b.patch | |
|
208 | hg qapplied test1b.patch | |
|
209 | echo % qunapplied -1 | |
|
210 | hg qunapplied -1 | |
|
211 | echo % qunapplied | |
|
212 | hg qunapplied | |
|
213 | echo % popping | |
|
214 | hg qpop | |
|
215 | echo % qunapplied -1 | |
|
216 | hg qunapplied -1 | |
|
217 | echo % qunapplied | |
|
218 | hg qunapplied | |
|
219 | echo % qunapplied test2.patch | |
|
220 | hg qunapplied test2.patch | |
|
221 | echo % qunapplied -1 test2.patch | |
|
222 | hg qunapplied -1 test2.patch | |
|
223 | echo % popping -a | |
|
224 | hg qpop -a | |
|
225 | echo % qapplied | |
|
226 | hg qapplied | |
|
227 | echo % qapplied -1 | |
|
228 | hg qapplied -1 | |
|
229 | hg qpush | |
|
230 | ||
|
200 | 231 | echo % push should succeed |
|
201 | 232 | hg qpop -a |
|
202 | 233 | hg push ../../k |
@@ -146,16 +146,12 b' test.patch' | |||
|
146 | 146 | test2.patch |
|
147 | 147 | % qtop |
|
148 | 148 | test2.patch |
|
149 |
% |
|
|
149 | % prev | |
|
150 | 150 | test.patch |
|
151 |
% |
|
|
151 | % next | |
|
152 | 152 | all patches applied |
|
153 | % pop, qnext, qprev, qapplied | |
|
154 | 153 | popping test2.patch |
|
155 | 154 | now at: test.patch |
|
156 | test2.patch | |
|
157 | only one patch applied | |
|
158 | test.patch | |
|
159 | 155 | % commit should fail |
|
160 | 156 | abort: cannot commit over an applied mq patch |
|
161 | 157 | % push should fail |
@@ -182,11 +178,50 b' now at: test.patch' | |||
|
182 | 178 | applying test1b.patch |
|
183 | 179 | applying test2.patch |
|
184 | 180 | now at: test2.patch |
|
185 | % push should succeed | |
|
181 | % pop, qapplied, qunapplied | |
|
182 | 0 A test.patch | |
|
183 | 1 A test1b.patch | |
|
184 | 2 A test2.patch | |
|
185 | % qapplied -1 test.patch | |
|
186 | only one patch applied | |
|
187 | % qapplied -1 test1b.patch | |
|
188 | test.patch | |
|
189 | % qapplied -1 test2.patch | |
|
190 | test1b.patch | |
|
191 | % qapplied -1 | |
|
192 | test1b.patch | |
|
193 | % qapplied | |
|
194 | test.patch | |
|
195 | test1b.patch | |
|
196 | test2.patch | |
|
197 | % qapplied test1b.patch | |
|
198 | test.patch | |
|
199 | test1b.patch | |
|
200 | % qunapplied -1 | |
|
201 | all patches applied | |
|
202 | % qunapplied | |
|
203 | % popping | |
|
186 | 204 | popping test2.patch |
|
205 | now at: test1b.patch | |
|
206 | % qunapplied -1 | |
|
207 | test2.patch | |
|
208 | % qunapplied | |
|
209 | test2.patch | |
|
210 | % qunapplied test2.patch | |
|
211 | % qunapplied -1 test2.patch | |
|
212 | all patches applied | |
|
213 | % popping -a | |
|
187 | 214 | popping test1b.patch |
|
188 | 215 | popping test.patch |
|
189 | 216 | patch queue now empty |
|
217 | % qapplied | |
|
218 | % qapplied -1 | |
|
219 | no patches applied | |
|
220 | applying test.patch | |
|
221 | now at: test.patch | |
|
222 | % push should succeed | |
|
223 | popping test.patch | |
|
224 | patch queue now empty | |
|
190 | 225 | pushing to ../../k |
|
191 | 226 | searching for changes |
|
192 | 227 | adding changesets |
General Comments 0
You need to be logged in to leave comments.
Login now