Show More
@@ -506,21 +506,28 b' class queue:' | |||||
506 | tr.close() |
|
506 | tr.close() | |
507 | return (err, n) |
|
507 | return (err, n) | |
508 |
|
508 | |||
509 | def delete(self, repo, patch, keep=False): |
|
509 | def delete(self, repo, patches, keep=False): | |
510 | patch = self.lookup(patch, strict=True) |
|
510 | realpatches = [] | |
511 | info = self.isapplied(patch) |
|
511 | for patch in patches: | |
512 | if info: |
|
512 | patch = self.lookup(patch, strict=True) | |
513 | raise util.Abort(_("cannot delete applied patch %s") % patch) |
|
513 | info = self.isapplied(patch) | |
514 | if patch not in self.series: |
|
514 | if info: | |
515 |
raise util.Abort(_("patch %s |
|
515 | raise util.Abort(_("cannot delete applied patch %s") % patch) | |
|
516 | if patch not in self.series: | |||
|
517 | raise util.Abort(_("patch %s not in series file") % patch) | |||
|
518 | realpatches.append(patch) | |||
|
519 | ||||
516 | if not keep: |
|
520 | if not keep: | |
517 | r = self.qrepo() |
|
521 | r = self.qrepo() | |
518 | if r: |
|
522 | if r: | |
519 |
r.remove( |
|
523 | r.remove(realpatches, True) | |
520 | else: |
|
524 | else: | |
521 | os.unlink(self.join(patch)) |
|
525 | os.unlink(self.join(patch)) | |
522 | i = self.find_series(patch) |
|
526 | ||
523 | del self.full_series[i] |
|
527 | indices = [self.find_series(p) for p in realpatches] | |
|
528 | indices.sort() | |||
|
529 | for i in indices[-1::-1]: | |||
|
530 | del self.full_series[i] | |||
524 | self.parse_series() |
|
531 | self.parse_series() | |
525 | self.series_dirty = 1 |
|
532 | self.series_dirty = 1 | |
526 |
|
533 | |||
@@ -1300,13 +1307,13 b' class queue:' | |||||
1300 | if qrepo: |
|
1307 | if qrepo: | |
1301 | qrepo.add(added) |
|
1308 | qrepo.add(added) | |
1302 |
|
1309 | |||
1303 | def delete(ui, repo, patch, **opts): |
|
1310 | def delete(ui, repo, patch, *patches, **opts): | |
1304 |
"""remove |
|
1311 | """remove patches from queue | |
1305 |
|
1312 | |||
1306 | The patch must not be applied. |
|
1313 | The patches must not be applied. | |
1307 |
With -k, the patch file |
|
1314 | With -k, the patch files are preserved in the patch directory.""" | |
1308 | q = repo.mq |
|
1315 | q = repo.mq | |
1309 | q.delete(repo, patch, keep=opts.get('keep')) |
|
1316 | q.delete(repo, (patch,) + patches, keep=opts.get('keep')) | |
1310 | q.save_dirty() |
|
1317 | q.save_dirty() | |
1311 | return 0 |
|
1318 | return 0 | |
1312 |
|
1319 |
General Comments 0
You need to be logged in to leave comments.
Login now