comparison hgext/mq.py @ 2990:ac74046f8f58

qrefresh: exit with status 1 if no patches applied.
author Bryan O'Sullivan <bos@serpentine.com>
date Tue, 22 Aug 2006 15:14:35 -0700
parents a9d7a43fb3f0
children 7017fc9a9478
comparison
equal deleted inserted replaced
2989:78fe7e2c2e1e 2990:ac74046f8f58
914 self.printdiff(repo, qp, files=pats, opts=opts) 914 self.printdiff(repo, qp, files=pats, opts=opts)
915 915
916 def refresh(self, repo, pats=None, **opts): 916 def refresh(self, repo, pats=None, **opts):
917 if len(self.applied) == 0: 917 if len(self.applied) == 0:
918 self.ui.write("No patches applied\n") 918 self.ui.write("No patches applied\n")
919 return 919 return 1
920 wlock = repo.wlock() 920 wlock = repo.wlock()
921 self.check_toppatch(repo) 921 self.check_toppatch(repo)
922 (top, patch) = (self.applied[-1].rev, self.applied[-1].name) 922 (top, patch) = (self.applied[-1].rev, self.applied[-1].name)
923 top = revlog.bin(top) 923 top = revlog.bin(top)
924 cparents = repo.changelog.parents(top) 924 cparents = repo.changelog.parents(top)
1448 if message: 1448 if message:
1449 raise util.Abort(_('option "-e" incompatible with "-m" or "-l"')) 1449 raise util.Abort(_('option "-e" incompatible with "-m" or "-l"'))
1450 patch = q.applied[-1].name 1450 patch = q.applied[-1].name
1451 (message, comment, user, date, hasdiff) = q.readheaders(patch) 1451 (message, comment, user, date, hasdiff) = q.readheaders(patch)
1452 message = ui.edit('\n'.join(message), user or ui.username()) 1452 message = ui.edit('\n'.join(message), user or ui.username())
1453 q.refresh(repo, pats, msg=message, **opts) 1453 ret = q.refresh(repo, pats, msg=message, **opts)
1454 q.save_dirty() 1454 q.save_dirty()
1455 return 0 1455 return ret
1456 1456
1457 def diff(ui, repo, *pats, **opts): 1457 def diff(ui, repo, *pats, **opts):
1458 """diff of the current patch""" 1458 """diff of the current patch"""
1459 repo.mq.diff(repo, pats, opts) 1459 repo.mq.diff(repo, pats, opts)
1460 return 0 1460 return 0