[PATCH] commands.export: accept -r option as revision specification

Alexander Solovyov piranha at piranha.org.ua
Sat Nov 28 08:48:48 CST 2009


# HG changeset patch
# User Alexander Solovyov <piranha at piranha.org.ua>
# Date 1259419687 -7200
# Node ID be7a600f5b82acd857bd362d035716dd21805ed0
# Parent  2059be77d4f8e33c7746f493f3f9edeee37a0d26
commands.export: accept -r option as revision specification

This brings consistency with other commands option and allows specification of
negative numbers (-r -2), which were recognized as options earlier.

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -1161,6 +1161,7 @@ def export(ui, repo, *changesets, **opts
     With the --switch-parent option, the diff will be against the
     second parent. It can be useful to review a merge.
     """
+    changesets += tuple(opts.get('rev', []))
     if not changesets:
         raise util.Abort(_("export requires at least one changeset"))
     revs = cmdutil.revrange(repo, changesets)
@@ -3444,7 +3445,8 @@ table = {
     "^export":
         (export,
          [('o', 'output', '', _('print output to file with formatted name')),
-          ('', 'switch-parent', None, _('diff against the second parent'))
+          ('', 'switch-parent', None, _('diff against the second parent')),
+          ('r', 'rev', [], _('revisions to export')),
           ] + diffopts,
          _('[OPTION]... [-o OUTFILESPEC] REV...')),
     "^forget":


More information about the Mercurial-devel mailing list