comparison hgext/mq.py @ 4408:f700ea2b0689

mq: fix qtop failure when the series ends with guarded patches.
author Patrick Mezard <pmezard@gmail.com>
date Sun, 06 May 2007 23:44:18 +0200
parents 7ae02bce8de2
children 28b7d949ef6a 0532491f7476
comparison
equal deleted inserted replaced
4407:8369672060b5 4408:f700ea2b0689
1262 return len(self.full_series) 1262 return len(self.full_series)
1263 return end + 1 1263 return end + 1
1264 return 0 1264 return 0
1265 1265
1266 def series_end(self, all_patches=False): 1266 def series_end(self, all_patches=False):
1267 """If all_patches is False, return the index of the next pushable patch
1268 in the series, or the series length. If all_patches is True, return the
1269 index of the first patch past the last applied one.
1270 """
1267 end = 0 1271 end = 0
1268 def next(start): 1272 def next(start):
1269 if all_patches: 1273 if all_patches:
1270 return start 1274 return start
1271 i = start 1275 i = start
1545 return 0 1549 return 0
1546 1550
1547 def top(ui, repo, **opts): 1551 def top(ui, repo, **opts):
1548 """print the name of the current patch""" 1552 """print the name of the current patch"""
1549 q = repo.mq 1553 q = repo.mq
1550 t = q.series_end() 1554 t = q.applied and q.series_end(True) or 0
1551 if t: 1555 if t:
1552 return q.qseries(repo, start=t-1, length=1, status='A', 1556 return q.qseries(repo, start=t-1, length=1, status='A',
1553 summary=opts.get('summary')) 1557 summary=opts.get('summary'))
1554 else: 1558 else:
1555 ui.write("No patches applied\n") 1559 ui.write("No patches applied\n")