##// END OF EJS Templates
Add -f option to qdelete, to remove patch file.
Brendan Cully -
r2752:5dfeda16 default
parent child Browse files
Show More
@@ -382,13 +382,19 b' class queue:'
382 tr.close()
382 tr.close()
383 return (err, n)
383 return (err, n)
384
384
385 def delete(self, repo, patch):
385 def delete(self, repo, patch, force=False):
386 patch = self.lookup(patch, strict=True)
386 patch = self.lookup(patch, strict=True)
387 info = self.isapplied(patch)
387 info = self.isapplied(patch)
388 if info:
388 if info:
389 raise util.Abort(_("cannot delete applied patch %s") % patch)
389 raise util.Abort(_("cannot delete applied patch %s") % patch)
390 if patch not in self.series:
390 if patch not in self.series:
391 raise util.Abort(_("patch %s not in series file") % patch)
391 raise util.Abort(_("patch %s not in series file") % patch)
392 if force:
393 r = self.qrepo()
394 if r:
395 r.remove([patch], True)
396 else:
397 os.unlink(os.path.join(self.path, patch))
392 i = self.find_series(patch)
398 i = self.find_series(patch)
393 del self.full_series[i]
399 del self.full_series[i]
394 self.read_series(self.full_series)
400 self.read_series(self.full_series)
@@ -1159,9 +1165,12 b' class queue:'
1159 qrepo.add(added)
1165 qrepo.add(added)
1160
1166
1161 def delete(ui, repo, patch, **opts):
1167 def delete(ui, repo, patch, **opts):
1162 """remove a patch from the series file"""
1168 """remove a patch from the series file
1169
1170 The patch must not be applied.
1171 With -f, deletes the patch file as well as the series entry."""
1163 q = repo.mq
1172 q = repo.mq
1164 q.delete(repo, patch)
1173 q.delete(repo, patch, force=opts.get('force'))
1165 q.save_dirty()
1174 q.save_dirty()
1166 return 0
1175 return 0
1167
1176
@@ -1559,7 +1568,10 b' cmdtable = {'
1559 commands.table["^commit|ci"][1],
1568 commands.table["^commit|ci"][1],
1560 'hg qcommit [OPTION]... [FILE]...'),
1569 'hg qcommit [OPTION]... [FILE]...'),
1561 "^qdiff": (diff, [], 'hg qdiff [FILE]...'),
1570 "^qdiff": (diff, [], 'hg qdiff [FILE]...'),
1562 "qdelete": (delete, [], 'hg qdelete PATCH'),
1571 "qdelete":
1572 (delete,
1573 [('f', 'force', None, _('delete patch file'))],
1574 'hg qdelete [-f] PATCH'),
1563 'qfold': (fold, [], 'hg qfold PATCH...'),
1575 'qfold': (fold, [], 'hg qfold PATCH...'),
1564 'qheader': (header, [],
1576 'qheader': (header, [],
1565 _('hg qheader [PATCH]')),
1577 _('hg qheader [PATCH]')),
General Comments 0
You need to be logged in to leave comments. Login now