[PATCH] support -k for qfinish
Matt Mackall
mpm at selenic.com
Mon Oct 24 08:19:36 CDT 2011
On Mon, 2011-10-24 at 13:51 +0800, Weijun Wang wrote:
> mq: keep the patch file after it's committed
We're in a code freeze, please resend after Nov 1.
> I'd like the patch file(s) kept in .hg/patches even after moved to
> repository history. To achieve this, we can add a -k option (as in
> qdelete)
>
> Thanks
> Weijun
>
> # HG changeset patch
> # User weijun
> # Date 1319435107 -28800
> # Node ID 14adf3b3ef067de482ab56707ca4130eca2e27d7
> # Parent 48d552eb8d43ee671f5799b191f15c2447e8de68
> Support -k for qfinish
>
> diff --git a/hgext/mq.py b/hgext/mq.py
> --- a/hgext/mq.py
> +++ b/hgext/mq.py
> @@ -797,9 +797,9 @@
> patches.append(patch)
> return patches
>
> - def finish(self, repo, revs):
> + def finish(self, repo, revs, keep=False):
> patches = self._revpatches(repo, sorted(revs))
> - self._cleanup(patches, len(patches))
> + self._cleanup(patches, len(patches), keep)
>
> def delete(self, repo, patches, opts):
> if not patches and not opts.get('rev'):
> @@ -2886,8 +2886,9 @@
> q.savedirty()
>
> @command("qfinish",
> - [('a', 'applied', None, _('finish all applied changesets'))],
> - _('hg qfinish [-a] [REV]...'))
> + [('k', 'keep', None, _('keep patch file')),
> + ('a', 'applied', None, _('finish all applied changesets'))],
> + _('hg qfinish [-k] [-a] [REV]...'))
> def finish(ui, repo, *revrange, **opts):
> """move applied patches into repository history
>
> @@ -2898,7 +2899,8 @@
> Accepts a revision range or the -a/--applied option. If --applied
> is specified, all applied mq revisions are removed from mq
> control. Otherwise, the given revisions must be at the base of the
> - stack of applied patches.
> + stack of applied patches. With -k/--keep, the patch files are
> + preserved in the patch directory.
>
> This can be especially useful if your changes have been applied to
> an upstream repository, or if you are about to push your changes
> @@ -2917,7 +2919,7 @@
> return 0
>
> revs = scmutil.revrange(repo, revrange)
> - q.finish(repo, revs)
> + q.finish(repo, revs, opts.get('keep'))
> q.savedirty()
> return 0
>
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel
--
Mathematics is the supreme nostalgia of our time.
More information about the Mercurial-devel
mailing list