Mercurial > hg
changeset 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 | 71029a3247cb |
children | c5ac397f7671 ee48e5ef8753 21e571c21a6b |
files | hgext/mq.py |
diffstat | 1 files changed, 8 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/mq.py Tue Aug 01 19:58:34 2006 -0700 +++ b/hgext/mq.py Wed Aug 02 06:36:27 2006 -0700 @@ -614,17 +614,16 @@ # 3) patchname[-+]num to indicate an offset in the series file def lookup(self, patch, strict=False): def partial_name(s): - count = 0 if s in self.series: return s - for x in self.series: - if s in x: - count += 1 - last = x - if count > 1: - return None - if count: - return last + matches = [x for x in self.series if s in x] + if len(matches) > 1: + self.ui.warn(_('patch name "%s" is ambiguous:\n') % s) + for m in matches: + self.ui.warn(' %s\n' % m) + return None + if matches: + return matches[0] if len(self.series) > 0 and len(self.applied) > 0: if s == 'qtip': return self.series[self.series_end()-1]