Show More
@@ -1682,17 +1682,35 b' def delete(ui, repo, *patches, **opts):' | |||||
1682 |
|
1682 | |||
1683 | def applied(ui, repo, patch=None, **opts): |
|
1683 | def applied(ui, repo, patch=None, **opts): | |
1684 | """print the patches already applied""" |
|
1684 | """print the patches already applied""" | |
|
1685 | ||||
1685 | q = repo.mq |
|
1686 | q = repo.mq | |
|
1687 | l = len(q.applied) | |||
|
1688 | ||||
1686 | if patch: |
|
1689 | if patch: | |
1687 | if patch not in q.series: |
|
1690 | if patch not in q.series: | |
1688 | raise util.Abort(_("patch %s is not in series file") % patch) |
|
1691 | raise util.Abort(_("patch %s is not in series file") % patch) | |
1689 | end = q.series.index(patch) + 1 |
|
1692 | end = q.series.index(patch) + 1 | |
1690 | else: |
|
1693 | else: | |
1691 | end = q.series_end(True) |
|
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 | def unapplied(ui, repo, patch=None, **opts): |
|
1711 | def unapplied(ui, repo, patch=None, **opts): | |
1695 | """print the patches not yet applied""" |
|
1712 | """print the patches not yet applied""" | |
|
1713 | ||||
1696 | q = repo.mq |
|
1714 | q = repo.mq | |
1697 | if patch: |
|
1715 | if patch: | |
1698 | if patch not in q.series: |
|
1716 | if patch not in q.series: | |
@@ -1700,7 +1718,14 b' def unapplied(ui, repo, patch=None, **op' | |||||
1700 | start = q.series.index(patch) + 1 |
|
1718 | start = q.series.index(patch) + 1 | |
1701 | else: |
|
1719 | else: | |
1702 | start = q.series_end(True) |
|
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 | def qimport(ui, repo, *filename, **opts): |
|
1730 | def qimport(ui, repo, *filename, **opts): | |
1706 | """import a patch |
|
1731 | """import a patch | |
@@ -2522,7 +2547,10 b' def uisetup(ui):' | |||||
2522 | seriesopts = [('s', 'summary', None, _('print first line of patch header'))] |
|
2547 | seriesopts = [('s', 'summary', None, _('print first line of patch header'))] | |
2523 |
|
2548 | |||
2524 | cmdtable = { |
|
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 | "qclone": |
|
2554 | "qclone": | |
2527 | (clone, |
|
2555 | (clone, | |
2528 | [('', 'pull', None, _('use pull protocol to copy metadata')), |
|
2556 | [('', 'pull', None, _('use pull protocol to copy metadata')), | |
@@ -2645,7 +2673,10 b' cmdtable = {' | |||||
2645 | ('n', 'nobackup', None, _('no backups'))], |
|
2673 | ('n', 'nobackup', None, _('no backups'))], | |
2646 | _('hg strip [-f] [-b] [-n] REV')), |
|
2674 | _('hg strip [-f] [-b] [-n] REV')), | |
2647 | "qtop": (top, [] + seriesopts, _('hg qtop [-s]')), |
|
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 | "qfinish": |
|
2680 | "qfinish": | |
2650 | (finish, |
|
2681 | (finish, | |
2651 | [('a', 'applied', None, _('finish all applied changesets'))], |
|
2682 | [('a', 'applied', None, _('finish all applied changesets'))], |
@@ -155,18 +155,13 b' hg qapplied' | |||||
155 | echo % qtop |
|
155 | echo % qtop | |
156 | hg qtop |
|
156 | hg qtop | |
157 |
|
157 | |||
158 |
echo % |
|
158 | echo % prev | |
159 | hg qprev |
|
159 | hg qapp -1 | |
160 |
|
||||
161 | echo % qnext |
|
|||
162 | hg qnext |
|
|||
163 |
|
160 | |||
164 | echo % pop, qnext, qprev, qapplied |
|
161 | echo % next | |
|
162 | hg qunapp -1 | |||
|
163 | ||||
165 | hg qpop |
|
164 | hg qpop | |
166 | hg qnext |
|
|||
167 | hg qprev |
|
|||
168 | hg qapplied |
|
|||
169 |
|
||||
170 | echo % commit should fail |
|
165 | echo % commit should fail | |
171 | hg commit |
|
166 | hg commit | |
172 |
|
167 | |||
@@ -197,6 +192,42 b' hg qpop test2.patch-1' | |||||
197 | hg qpop test2.patch-2 |
|
192 | hg qpop test2.patch-2 | |
198 | hg qpush test1b.patch+1 |
|
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 | echo % push should succeed |
|
231 | echo % push should succeed | |
201 | hg qpop -a |
|
232 | hg qpop -a | |
202 | hg push ../../k |
|
233 | hg push ../../k |
@@ -146,16 +146,12 b' test.patch' | |||||
146 | test2.patch |
|
146 | test2.patch | |
147 | % qtop |
|
147 | % qtop | |
148 | test2.patch |
|
148 | test2.patch | |
149 |
% |
|
149 | % prev | |
150 | test.patch |
|
150 | test.patch | |
151 |
% |
|
151 | % next | |
152 | all patches applied |
|
152 | all patches applied | |
153 | % pop, qnext, qprev, qapplied |
|
|||
154 | popping test2.patch |
|
153 | popping test2.patch | |
155 | now at: test.patch |
|
154 | now at: test.patch | |
156 | test2.patch |
|
|||
157 | only one patch applied |
|
|||
158 | test.patch |
|
|||
159 | % commit should fail |
|
155 | % commit should fail | |
160 | abort: cannot commit over an applied mq patch |
|
156 | abort: cannot commit over an applied mq patch | |
161 | % push should fail |
|
157 | % push should fail | |
@@ -182,11 +178,50 b' now at: test.patch' | |||||
182 | applying test1b.patch |
|
178 | applying test1b.patch | |
183 | applying test2.patch |
|
179 | applying test2.patch | |
184 | now at: test2.patch |
|
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 | popping test2.patch |
|
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 | popping test1b.patch |
|
214 | popping test1b.patch | |
188 | popping test.patch |
|
215 | popping test.patch | |
189 | patch queue now empty |
|
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 | pushing to ../../k |
|
225 | pushing to ../../k | |
191 | searching for changes |
|
226 | searching for changes | |
192 | adding changesets |
|
227 | adding changesets |
General Comments 0
You need to be logged in to leave comments.
Login now