comparison hgext/mq.py @ 2765:0327bd1c831c

mq: print matches if patch name not unique
author Vadim Gelfer <vadim.gelfer@gmail.com>
date Wed, 02 Aug 2006 06:36:27 -0700
parents 787e18b84893
children c5ac397f7671 ee48e5ef8753
comparison
equal deleted inserted replaced
2764:71029a3247cb 2765:0327bd1c831c
612 # 1) a number to indicate an offset in the series file 612 # 1) a number to indicate an offset in the series file
613 # 2) a unique substring of the patch name was given 613 # 2) a unique substring of the patch name was given
614 # 3) patchname[-+]num to indicate an offset in the series file 614 # 3) patchname[-+]num to indicate an offset in the series file
615 def lookup(self, patch, strict=False): 615 def lookup(self, patch, strict=False):
616 def partial_name(s): 616 def partial_name(s):
617 count = 0
618 if s in self.series: 617 if s in self.series:
619 return s 618 return s
620 for x in self.series: 619 matches = [x for x in self.series if s in x]
621 if s in x: 620 if len(matches) > 1:
622 count += 1 621 self.ui.warn(_('patch name "%s" is ambiguous:\n') % s)
623 last = x 622 for m in matches:
624 if count > 1: 623 self.ui.warn(' %s\n' % m)
625 return None 624 return None
626 if count: 625 if matches:
627 return last 626 return matches[0]
628 if len(self.series) > 0 and len(self.applied) > 0: 627 if len(self.series) > 0 and len(self.applied) > 0:
629 if s == 'qtip': 628 if s == 'qtip':
630 return self.series[self.series_end()-1] 629 return self.series[self.series_end()-1]
631 if s == 'qbase': 630 if s == 'qbase':
632 return self.series[0] 631 return self.series[0]