##// END OF EJS Templates
mq: prevent the creation of a queue whose name is already taken...
Cédric Duval -
r11271:d1aca086 default
parent child Browse files
Show More
@@ -2633,17 +2633,17 b' def qqueue(ui, repo, name=None, **opts):'
2633 2633
2634 2634 existing = _getqueues()
2635 2635
2636 if name not in existing and opts.get('delete'):
2637 raise util.Abort(_('cannot delete queue that does not exist'))
2638 elif name not in existing and not opts.get('create'):
2639 raise util.Abort(_('use --create to create a new queue'))
2640
2641 2636 if opts.get('create'):
2637 if name in existing:
2638 raise util.Abort(_('queue "%s" already exists') % name)
2642 2639 if _noqueues():
2643 2640 _addqueue(_defaultqueue)
2644 2641 _addqueue(name)
2645 2642 _setactive(name)
2646 2643 elif opts.get('delete'):
2644 if name not in existing:
2645 raise util.Abort(_('cannot delete queue that does not exist'))
2646
2647 2647 current = _getcurrent()
2648 2648
2649 2649 if name == current:
@@ -2657,6 +2657,8 b' def qqueue(ui, repo, name=None, **opts):'
2657 2657 fh.close()
2658 2658 util.rename(repo.join('patches.queues.new'), repo.join(_allqueues))
2659 2659 else:
2660 if name not in existing:
2661 raise util.Abort(_('use --create to create a new queue'))
2660 2662 _setactive(name)
2661 2663
2662 2664 def reposetup(ui, repo):
@@ -28,6 +28,10 b' echo %% switch queue'
28 28 hg qqueue foo
29 29 hg qqueue
30 30
31 echo %% fail creating queue with already existing name
32 hg qqueue --create foo
33 hg qqueue
34
31 35 echo %% unapplied patches
32 36 hg qun
33 37 echo c > a
@@ -12,6 +12,10 b' patch queue now empty'
12 12 %% switch queue
13 13 foo (active)
14 14 patches
15 %% fail creating queue with already existing name
16 abort: queue "foo" already exists
17 foo (active)
18 patches
15 19 %% unapplied patches
16 20 %% fail switching back
17 21 abort: patches applied - cannot set new queue active
General Comments 0
You need to be logged in to leave comments. Login now