[PATCH] mq: Teach qdelete -u option

Gilles Moris gilles.moris at free.fr
Thu Aug 6 02:01:42 CDT 2009


On Wed August 5 2009 16:39:38 David Soria Parra wrote:
> mq: Teach qdelete -u option
> 
> Passing -u to qdelete will delete all unapplied patches from the queue.
> updated version
> 

The commit message still mention the -u option and not --unapplied

> diff --git a/hgext/mq.py b/hgext/mq.py
> --- a/hgext/mq.py
> +++ b/hgext/mq.py
> @@ -666,10 +666,18 @@
>          self._cleanup(patches, len(patches))
>  
>      def delete(self, repo, patches, opts):
> -        if not patches and not opts.get('rev'):
> +        if not patches and not opts.get('rev') and not opts.get('unapplied'):
>              raise util.Abort(_('qdelete requires at least one revision or '
>                                 'patch name'))
> -
> +        if opts.get('unapplied') and (patches or opts.get('rev')):
> +            raise util.Abort(_('specifiyng patches or revisions conflicts'

Typo: specifying

> +                               'with --unapplied'))
> +        if opts.get('unapplied'):
> +            patches = []
> +            for i in xrange(self.series_end(), len(self.series)):
> +                pushable, reason = self.pushable(i)
> +                if pushable:
> +                    patches.append(self.series[i])
>          realpatches = []
>          for patch in patches:
>              patch = self.lookup(patch, strict=True)
> @@ -2522,6 +2530,7 @@
>      "qdelete|qremove|qrm":
>          (delete,
>           [('k', 'keep', None, _('keep patch file')),
> +          ('', 'unapplied', None, _('delete all unapplied patches')),
>            ('r', 'rev', [], _('stop managing a revision (DEPRECATED)'))],
>           _('hg qdelete [-k] [-r REV]... [PATCH]...')),
>      'qfold':
> diff --git a/tests/test-mq-qdelete b/tests/test-mq-qdelete
> --- a/tests/test-mq-qdelete
> +++ b/tests/test-mq-qdelete
> @@ -65,3 +65,20 @@
>  hg qapplied
>  hg log --template '{rev} {desc}\n'
>  ls .hg/patches
> +
> +cd ..
> +hg init c
> +cd c
> +
> +echo 'base' > base
> +hg ci -Ambase -d '1 0'
> +
> +hg qnew -d '1 0' a
> +hg qnew -d '1 0' b
> +hg qnew -d '1 0' c
> +
> +hg qpop
> +hg qpop
> +hg qseries
> +hg qdelete -u

Test also still uses the -u option, thus the test fails.

> +hg qseries

Regards.
Gilles.



More information about the Mercurial-devel mailing list