comparison hgext/mq.py @ 2992:7017fc9a9478

MQ: Make more commands return meaningful errors.
author Bryan O'Sullivan <bos@serpentine.com>
date Tue, 22 Aug 2006 16:03:55 -0700
parents ac74046f8f58
children c203ccd7d838
comparison
equal deleted inserted replaced
2991:18c661e9abd9 2992:7017fc9a9478
1236 if len(self.applied): 1236 if len(self.applied):
1237 p = self.appliedname(-1) 1237 p = self.appliedname(-1)
1238 self.ui.write(p + '\n') 1238 self.ui.write(p + '\n')
1239 else: 1239 else:
1240 self.ui.write("No patches applied\n") 1240 self.ui.write("No patches applied\n")
1241 return 1
1241 1242
1242 def next(self, repo): 1243 def next(self, repo):
1243 end = self.series_end() 1244 end = self.series_end()
1244 if end == len(self.series): 1245 if end == len(self.series):
1245 self.ui.write("All patches applied\n") 1246 self.ui.write("All patches applied\n")
1247 return 1
1246 else: 1248 else:
1247 p = self.series[end] 1249 p = self.series[end]
1248 if self.ui.verbose: 1250 if self.ui.verbose:
1249 self.ui.write("%d " % self.series.index(p)) 1251 self.ui.write("%d " % self.series.index(p))
1250 self.ui.write(p + '\n') 1252 self.ui.write(p + '\n')
1253 if len(self.applied) > 1: 1255 if len(self.applied) > 1:
1254 p = self.appliedname(-2) 1256 p = self.appliedname(-2)
1255 self.ui.write(p + '\n') 1257 self.ui.write(p + '\n')
1256 elif len(self.applied) == 1: 1258 elif len(self.applied) == 1:
1257 self.ui.write("Only one patch applied\n") 1259 self.ui.write("Only one patch applied\n")
1260 return 1
1258 else: 1261 else:
1259 self.ui.write("No patches applied\n") 1262 self.ui.write("No patches applied\n")
1263 return 1
1260 1264
1261 def qimport(self, repo, files, patch=None, existing=None, force=None): 1265 def qimport(self, repo, files, patch=None, existing=None, force=None):
1262 if len(files) > 1 and patch: 1266 if len(files) > 1 and patch:
1263 raise util.Abort(_('option "-n" not valid when importing multiple ' 1267 raise util.Abort(_('option "-n" not valid when importing multiple '
1264 'files')) 1268 'files'))
1401 repo.mq.qseries(repo, missing=opts['missing'], summary=opts['summary']) 1405 repo.mq.qseries(repo, missing=opts['missing'], summary=opts['summary'])
1402 return 0 1406 return 0
1403 1407
1404 def top(ui, repo, **opts): 1408 def top(ui, repo, **opts):
1405 """print the name of the current patch""" 1409 """print the name of the current patch"""
1406 repo.mq.top(repo) 1410 return repo.mq.top(repo)
1407 return 0
1408 1411
1409 def next(ui, repo, **opts): 1412 def next(ui, repo, **opts):
1410 """print the name of the next patch""" 1413 """print the name of the next patch"""
1411 repo.mq.next(repo) 1414 return repo.mq.next(repo)
1412 return 0
1413 1415
1414 def prev(ui, repo, **opts): 1416 def prev(ui, repo, **opts):
1415 """print the name of the previous patch""" 1417 """print the name of the previous patch"""
1416 repo.mq.prev(repo) 1418 return repo.mq.prev(repo)
1417 return 0
1418 1419
1419 def new(ui, repo, patch, **opts): 1420 def new(ui, repo, patch, **opts):
1420 """create a new patch 1421 """create a new patch
1421 1422
1422 qnew creates a new patch on top of the currently-applied patch 1423 qnew creates a new patch on top of the currently-applied patch