# HG changeset patch # User Patrick Mezard # Date 1211122884 -7200 # Node ID 75b506f0e5719b4d194514f0348103d2257ef343 # Parent 088ba40585b95cd20dad90dbe15fa5999f42bfa8 mq: make qselect fail properly on an empty guard diff -r 088ba40585b9 -r 75b506f0e571 hgext/mq.py --- a/hgext/mq.py Sat May 17 09:11:14 2008 +0200 +++ b/hgext/mq.py Sun May 18 17:01:24 2008 +0200 @@ -126,6 +126,8 @@ self.series_guards.append(self.guard_re.findall(comment)) def check_guard(self, guard): + if not guard: + return _('guard cannot be an empty string') bad_chars = '# \t\r\n\f' first = guard[0] for c in '-+': diff -r 088ba40585b9 -r 75b506f0e571 tests/test-mq-guards --- a/tests/test-mq-guards Sat May 17 09:11:14 2008 +0200 +++ b/tests/test-mq-guards Sun May 18 17:01:24 2008 +0200 @@ -44,6 +44,8 @@ hg qpush hg qpop +echo % test selection of an empty guard +hg qselect "" hg qselect a echo % should push a.patch hg qpush diff -r 088ba40585b9 -r 75b506f0e571 tests/test-mq-guards.out --- a/tests/test-mq-guards.out Sat May 17 09:11:14 2008 +0200 +++ b/tests/test-mq-guards.out Sun May 18 17:01:24 2008 +0200 @@ -15,6 +15,8 @@ applying b.patch Now at: b.patch Patch queue now empty +% test selection of an empty guard +abort: guard cannot be an empty string number of unguarded, unapplied patches has changed from 2 to 3 % should push a.patch applying a.patch