Mercurial > hg-stable
changeset 7607:3cf85220a9f9
merge with crew-stable
author | Dirkjan Ochtman <dirkjan@ochtman.nl> |
---|---|
date | Tue, 06 Jan 2009 10:33:57 +0100 |
parents | e86ca711544d (current diff) 12df451ce205 (diff) |
children | 560e3e882aba |
files | hgext/mq.py |
diffstat | 3 files changed, 46 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/mq.py Mon Jan 05 20:49:12 2009 +0100 +++ b/hgext/mq.py Tue Jan 06 10:33:57 2009 +0100 @@ -838,14 +838,11 @@ if s == 'qbase': return self.series[0] return None + if patch == None: return None - - # we don't want to return a partial match until we make - # sure the file name passed in does not exist (checked below) - res = partial_name(patch) - if res and res == patch: - return res + if patch in self.series: + return patch if not os.path.isfile(self.join(patch)): try: @@ -853,10 +850,11 @@ except(ValueError, OverflowError): pass else: - if sno < len(self.series): + if -len(self.series) <= sno < len(self.series): return self.series[sno] + if not strict: - # return any partial match made above + res = partial_name(patch) if res: return res minus = patch.rfind('-')
--- a/tests/test-mq-qgoto Mon Jan 05 20:49:12 2009 +0100 +++ b/tests/test-mq-qgoto Tue Jan 06 10:33:57 2009 +0100 @@ -25,3 +25,25 @@ hg qgoto a.patch hg qgoto c.patch hg qgoto b.patch + +echo +echo % Using index +hg qgoto 0 +hg qgoto 2 + +echo +echo % No warnings when using index +hg qnew bug314159 +echo d >> c +hg qrefresh +hg qnew bug141421 +echo e >> c +hg qrefresh +hg qgoto 1 +hg qgoto 3 + +echo +echo % Detect ambiguous non-index +hg qgoto 14 + +exit 0
--- a/tests/test-mq-qgoto.out Mon Jan 05 20:49:12 2009 +0100 +++ b/tests/test-mq-qgoto.out Tue Jan 06 10:33:57 2009 +0100 @@ -4,3 +4,21 @@ applying c.patch Now at: c.patch Now at: b.patch + +% Using index +Now at: a.patch +applying b.patch +applying c.patch +Now at: c.patch + +% No warnings when using index +Now at: b.patch +applying c.patch +applying bug314159 +Now at: bug314159 + +% Detect ambiguous non-index +patch name "14" is ambiguous: + bug314159 + bug141421 +abort: patch 14 not in series