--- a/hgext/mq.py Thu Aug 19 16:34:12 2010 +0200
+++ b/hgext/mq.py Wed Aug 18 23:34:28 2010 +0200
@@ -2695,6 +2695,23 @@
return False
return True
+ def _delete(name):
+ if name not in existing:
+ raise util.Abort(_('cannot delete queue that does not exist'))
+
+ current = _getcurrent()
+
+ if name == current:
+ raise util.Abort(_('cannot delete currently active queue'))
+
+ fh = repo.opener('patches.queues.new', 'w')
+ for queue in existing:
+ if queue == name:
+ continue
+ fh.write('%s\n' % (queue,))
+ fh.close()
+ util.rename(repo.join('patches.queues.new'), repo.join(_allqueues))
+
if not name or opts.get('list'):
current = _getcurrent()
for queue in _getqueues():
@@ -2744,21 +2761,7 @@
util.rename(repo.join('patches.queues.new'), repo.join(_allqueues))
_setactivenocheck(name)
elif opts.get('delete'):
- if name not in existing:
- raise util.Abort(_('cannot delete queue that does not exist'))
-
- current = _getcurrent()
-
- if name == current:
- raise util.Abort(_('cannot delete currently active queue'))
-
- fh = repo.opener('patches.queues.new', 'w')
- for queue in existing:
- if queue == name:
- continue
- fh.write('%s\n' % (queue,))
- fh.close()
- util.rename(repo.join('patches.queues.new'), repo.join(_allqueues))
+ _delete(name)
else:
if name not in existing:
raise util.Abort(_('use --create to create a new queue'))