Mercurial > public > mercurial-scm > hg
diff hgext/mq.py @ 11967:6e3875a80533
mq/qqueue: add --purge option to delete a queue and its patch dir
qqueue --delete only deletes the reference to the queue, and leaves
the associated patch directory behind. There is no Mercurial-way of
getting rid of that patch directory afterward.
This patch adds the --purge option to qqueue, that deletes the queue
from the list, and also removes the associated patch dir. If the queue
was non-existant, but the patch dir was, it is removed nonetheless.
This is to avoid manual intervention in the .hg directory.
author | "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr> |
---|---|
date | Wed, 18 Aug 2010 23:37:19 +0200 |
parents | 22f1994fb669 |
children | fca15617721c |
line wrap: on
line diff
--- a/hgext/mq.py Wed Aug 18 23:34:28 2010 +0200 +++ b/hgext/mq.py Wed Aug 18 23:37:19 2010 +0200 @@ -47,7 +47,7 @@ from mercurial.lock import release from mercurial import commands, cmdutil, hg, patch, util from mercurial import repair, extensions, url, error -import os, sys, re, errno +import os, sys, re, errno, shutil commands.norepo += " qclone" @@ -2762,6 +2762,12 @@ _setactivenocheck(name) elif opts.get('delete'): _delete(name) + elif opts.get('purge'): + if name in existing: + _delete(name) + qdir = _queuedir(name) + if os.path.exists(qdir): + shutil.rmtree(qdir) else: if name not in existing: raise util.Abort(_('use --create to create a new queue')) @@ -3089,6 +3095,7 @@ ('c', 'create', False, _('create new queue')), ('', 'rename', False, _('rename active queue')), ('', 'delete', False, _('delete reference to queue')), + ('', 'purge', False, _('delete queue, and remove patch dir')), ], _('[OPTION] [QUEUE]')), }