Show More
@@ -1146,7 +1146,7 b' class queue:' | |||||
1146 | self.explain_pushable(i) |
|
1146 | self.explain_pushable(i) | |
1147 | return unapplied |
|
1147 | return unapplied | |
1148 |
|
1148 | |||
1149 |
def qseries(self, repo, missing=None, start=0, length= |
|
1149 | def qseries(self, repo, missing=None, start=0, length=None, status=None, | |
1150 | summary=False): |
|
1150 | summary=False): | |
1151 | def displayname(patchname): |
|
1151 | def displayname(patchname): | |
1152 | if summary: |
|
1152 | if summary: | |
@@ -1156,27 +1156,23 b' class queue:' | |||||
1156 | msg = '' |
|
1156 | msg = '' | |
1157 | return '%s%s' % (patchname, msg) |
|
1157 | return '%s%s' % (patchname, msg) | |
1158 |
|
1158 | |||
1159 | def pname(i): |
|
|||
1160 | if status == 'A': |
|
|||
1161 | return self.applied[i].name |
|
|||
1162 | else: |
|
|||
1163 | return self.series[i] |
|
|||
1164 |
|
||||
1165 | applied = dict.fromkeys([p.name for p in self.applied]) |
|
1159 | applied = dict.fromkeys([p.name for p in self.applied]) | |
1166 |
if |
|
1160 | if length is None: | |
1167 | length = len(self.series) - start |
|
1161 | length = len(self.series) - start | |
1168 | if not missing: |
|
1162 | if not missing: | |
1169 | for i in xrange(start, start+length): |
|
1163 | for i in xrange(start, start+length): | |
|
1164 | patch = self.series[i] | |||
|
1165 | if patch in applied: | |||
|
1166 | stat = 'A' | |||
|
1167 | elif self.pushable(i)[0]: | |||
|
1168 | stat = 'U' | |||
|
1169 | else: | |||
|
1170 | stat = 'G' | |||
1170 | pfx = '' |
|
1171 | pfx = '' | |
1171 | patch = pname(i) |
|
|||
1172 | if self.ui.verbose: |
|
1172 | if self.ui.verbose: | |
1173 | if patch in applied: |
|
|||
1174 | stat = 'A' |
|
|||
1175 | elif self.pushable(i)[0]: |
|
|||
1176 | stat = 'U' |
|
|||
1177 | else: |
|
|||
1178 | stat = 'G' |
|
|||
1179 | pfx = '%d %s ' % (i, stat) |
|
1173 | pfx = '%d %s ' % (i, stat) | |
|
1174 | elif status and status != stat: | |||
|
1175 | continue | |||
1180 | self.ui.write('%s%s\n' % (pfx, displayname(patch))) |
|
1176 | self.ui.write('%s%s\n' % (pfx, displayname(patch))) | |
1181 | else: |
|
1177 | else: | |
1182 | msng_list = [] |
|
1178 | msng_list = [] | |
@@ -1185,7 +1181,8 b' class queue:' | |||||
1185 | for f in files: |
|
1181 | for f in files: | |
1186 | fl = os.path.join(d, f) |
|
1182 | fl = os.path.join(d, f) | |
1187 | if (fl not in self.series and |
|
1183 | if (fl not in self.series and | |
1188 |
fl not in (self.status_path, self.series_path |
|
1184 | fl not in (self.status_path, self.series_path, | |
|
1185 | self.guards_path) | |||
1189 | and not fl.startswith('.')): |
|
1186 | and not fl.startswith('.')): | |
1190 | msng_list.append(fl) |
|
1187 | msng_list.append(fl) | |
1191 | msng_list.sort() |
|
1188 | msng_list.sort() | |
@@ -1460,10 +1457,7 b' def applied(ui, repo, patch=None, **opts' | |||||
1460 | raise util.Abort(_("patch %s is not in series file") % patch) |
|
1457 | raise util.Abort(_("patch %s is not in series file") % patch) | |
1461 | end = q.series.index(patch) + 1 |
|
1458 | end = q.series.index(patch) + 1 | |
1462 | else: |
|
1459 | else: | |
1463 |
end = |
|
1460 | end = q.series_end(True) | |
1464 | if not end: |
|
|||
1465 | return |
|
|||
1466 |
|
||||
1467 | return q.qseries(repo, length=end, status='A', summary=opts.get('summary')) |
|
1461 | return q.qseries(repo, length=end, status='A', summary=opts.get('summary')) | |
1468 |
|
1462 | |||
1469 | def unapplied(ui, repo, patch=None, **opts): |
|
1463 | def unapplied(ui, repo, patch=None, **opts): | |
@@ -1474,8 +1468,8 b' def unapplied(ui, repo, patch=None, **op' | |||||
1474 | raise util.Abort(_("patch %s is not in series file") % patch) |
|
1468 | raise util.Abort(_("patch %s is not in series file") % patch) | |
1475 | start = q.series.index(patch) + 1 |
|
1469 | start = q.series.index(patch) + 1 | |
1476 | else: |
|
1470 | else: | |
1477 | start = q.series_end() |
|
1471 | start = q.series_end(True) | |
1478 | q.qseries(repo, start=start, summary=opts.get('summary')) |
|
1472 | q.qseries(repo, start=start, status='U', summary=opts.get('summary')) | |
1479 |
|
1473 | |||
1480 | def qimport(ui, repo, *filename, **opts): |
|
1474 | def qimport(ui, repo, *filename, **opts): | |
1481 | """import a patch |
|
1475 | """import a patch | |
@@ -2162,7 +2156,7 b' cmdtable = {' | |||||
2162 | 'hg qfold [-e] [-m <text>] [-l <file] PATCH...'), |
|
2156 | 'hg qfold [-e] [-m <text>] [-l <file] PATCH...'), | |
2163 | 'qguard': (guard, [('l', 'list', None, _('list all patches and guards')), |
|
2157 | 'qguard': (guard, [('l', 'list', None, _('list all patches and guards')), | |
2164 | ('n', 'none', None, _('drop all guards'))], |
|
2158 | ('n', 'none', None, _('drop all guards'))], | |
2165 |
'hg qguard [PATCH] [+GUARD... |
|
2159 | 'hg qguard [PATCH] [+GUARD]... [-GUARD]...'), | |
2166 | 'qheader': (header, [], |
|
2160 | 'qheader': (header, [], | |
2167 | _('hg qheader [PATCH]')), |
|
2161 | _('hg qheader [PATCH]')), | |
2168 | "^qimport": |
|
2162 | "^qimport": | |
@@ -2207,7 +2201,7 b' cmdtable = {' | |||||
2207 | ('I', 'include', [], _('include names matching the given patterns')), |
|
2201 | ('I', 'include', [], _('include names matching the given patterns')), | |
2208 | ('X', 'exclude', [], _('exclude names matching the given patterns')) |
|
2202 | ('X', 'exclude', [], _('exclude names matching the given patterns')) | |
2209 | ] + commands.commitopts, |
|
2203 | ] + commands.commitopts, | |
2210 |
'hg qrefresh [-I] [-X] [-e] [-m TEXT] [-l FILE] [-s] |
|
2204 | 'hg qrefresh [-I] [-X] [-e] [-m TEXT] [-l FILE] [-s] [FILE]...'), | |
2211 | 'qrename|qmv': |
|
2205 | 'qrename|qmv': | |
2212 | (rename, [], 'hg qrename PATCH1 [PATCH2]'), |
|
2206 | (rename, [], 'hg qrename PATCH1 [PATCH2]'), | |
2213 | "qrestore": |
|
2207 | "qrestore": | |
@@ -2228,7 +2222,7 b' cmdtable = {' | |||||
2228 | ('', 'pop', None, |
|
2222 | ('', 'pop', None, | |
2229 | _('pop to before first guarded applied patch')), |
|
2223 | _('pop to before first guarded applied patch')), | |
2230 | ('', 'reapply', None, _('pop, then reapply patches'))], |
|
2224 | ('', 'reapply', None, _('pop, then reapply patches'))], | |
2231 |
'hg qselect [OPTION... |
|
2225 | 'hg qselect [OPTION]... [GUARD]...'), | |
2232 | "qseries": |
|
2226 | "qseries": | |
2233 | (series, |
|
2227 | (series, | |
2234 | [('m', 'missing', None, 'print patches not in series')] + seriesopts, |
|
2228 | [('m', 'missing', None, 'print patches not in series')] + seriesopts, |
@@ -118,3 +118,33 b' hg qseries -v' | |||||
118 | hg qguard d.patch +2 |
|
118 | hg qguard d.patch +2 | |
119 | echo % new.patch, b.patch: Guarded. c.patch: Applied. d.patch: Guarded. |
|
119 | echo % new.patch, b.patch: Guarded. c.patch: Applied. d.patch: Guarded. | |
120 | hg qseries -v |
|
120 | hg qseries -v | |
|
121 | ||||
|
122 | qappunappv() | |||
|
123 | ( | |||
|
124 | for command in qapplied "qapplied -v" qunapplied "qunapplied -v"; do | |||
|
125 | echo % hg $command | |||
|
126 | hg $command | |||
|
127 | done | |||
|
128 | ) | |||
|
129 | ||||
|
130 | hg qpop -a | |||
|
131 | hg qguard -l | |||
|
132 | qappunappv | |||
|
133 | hg qselect 1 | |||
|
134 | qappunappv | |||
|
135 | hg qpush -a | |||
|
136 | qappunappv | |||
|
137 | hg qselect 2 | |||
|
138 | qappunappv | |||
|
139 | ||||
|
140 | for patch in `hg qseries`; do | |||
|
141 | echo % hg qapplied $patch | |||
|
142 | hg qapplied $patch | |||
|
143 | echo % hg qunapplied $patch | |||
|
144 | hg qunapplied $patch | |||
|
145 | done | |||
|
146 | ||||
|
147 | echo % hg qseries -m: only b.patch should be shown | |||
|
148 | echo the guards file was not ignored in the past | |||
|
149 | hg qdelete -k b.patch | |||
|
150 | hg qseries -m |
@@ -103,3 +103,77 b' 0 G new.patch' | |||||
103 | 1 G b.patch |
|
103 | 1 G b.patch | |
104 | 2 A c.patch |
|
104 | 2 A c.patch | |
105 | 3 G d.patch |
|
105 | 3 G d.patch | |
|
106 | Patch queue now empty | |||
|
107 | new.patch: +1 +2 -3 | |||
|
108 | b.patch: +2 | |||
|
109 | c.patch: unguarded | |||
|
110 | d.patch: +2 | |||
|
111 | % hg qapplied | |||
|
112 | % hg qapplied -v | |||
|
113 | % hg qunapplied | |||
|
114 | c.patch | |||
|
115 | % hg qunapplied -v | |||
|
116 | 0 G new.patch | |||
|
117 | 1 G b.patch | |||
|
118 | 2 U c.patch | |||
|
119 | 3 G d.patch | |||
|
120 | number of unguarded, unapplied patches has changed from 1 to 2 | |||
|
121 | % hg qapplied | |||
|
122 | % hg qapplied -v | |||
|
123 | % hg qunapplied | |||
|
124 | new.patch | |||
|
125 | c.patch | |||
|
126 | % hg qunapplied -v | |||
|
127 | 0 U new.patch | |||
|
128 | 1 G b.patch | |||
|
129 | 2 U c.patch | |||
|
130 | 3 G d.patch | |||
|
131 | applying new.patch | |||
|
132 | skipping b.patch - guarded by ['+2'] | |||
|
133 | applying c.patch | |||
|
134 | skipping d.patch - guarded by ['+2'] | |||
|
135 | Now at: c.patch | |||
|
136 | % hg qapplied | |||
|
137 | new.patch | |||
|
138 | c.patch | |||
|
139 | % hg qapplied -v | |||
|
140 | 0 A new.patch | |||
|
141 | 1 G b.patch | |||
|
142 | 2 A c.patch | |||
|
143 | % hg qunapplied | |||
|
144 | % hg qunapplied -v | |||
|
145 | 3 G d.patch | |||
|
146 | number of unguarded, unapplied patches has changed from 0 to 1 | |||
|
147 | number of guarded, applied patches has changed from 1 to 0 | |||
|
148 | % hg qapplied | |||
|
149 | new.patch | |||
|
150 | c.patch | |||
|
151 | % hg qapplied -v | |||
|
152 | 0 A new.patch | |||
|
153 | 1 U b.patch | |||
|
154 | 2 A c.patch | |||
|
155 | % hg qunapplied | |||
|
156 | d.patch | |||
|
157 | % hg qunapplied -v | |||
|
158 | 3 U d.patch | |||
|
159 | % hg qapplied new.patch | |||
|
160 | new.patch | |||
|
161 | % hg qunapplied new.patch | |||
|
162 | b.patch | |||
|
163 | d.patch | |||
|
164 | % hg qapplied b.patch | |||
|
165 | new.patch | |||
|
166 | % hg qunapplied b.patch | |||
|
167 | d.patch | |||
|
168 | % hg qapplied c.patch | |||
|
169 | new.patch | |||
|
170 | c.patch | |||
|
171 | % hg qunapplied c.patch | |||
|
172 | d.patch | |||
|
173 | % hg qapplied d.patch | |||
|
174 | new.patch | |||
|
175 | c.patch | |||
|
176 | % hg qunapplied d.patch | |||
|
177 | % hg qseries -m: only b.patch should be shown | |||
|
178 | the guards file was not ignored in the past | |||
|
179 | b.patch |
General Comments 0
You need to be logged in to leave comments.
Login now