[PATCH] fancyopts: Parse options that occur after arguments

Matt Mackall mpm at selenic.com
Tue Feb 10 15:56:55 CST 2009


On Tue, 2009-02-10 at 13:30 -0600, Augie Fackler wrote:
> # HG changeset patch
> # User Augie Fackler <durin42 at gmail.com>
> # Date 1234293960 21600
> # Node ID 6db88544fd8f0a6bde344e7e93bdcb382155612d
> # Parent  b034161948959e36879bf96f29553b5a274e58a2
> fancyopts: Parse options that occur after arguments.
> 
> This changes the behavior of qguard in the case of setting negative guards, as -- will now always be required.
> Fixes issue1402.

Queued. Everyone should note that I'm making a special exception for
this patch as it improves command line usability across the board while
breaking backward compatibility for one rarely used extension command
with a non-standard command syntax.

Also, you forgot to update the docs like I asked:

diff -r 249034cf3e98 hgext/mq.py
--- a/hgext/mq.py	Tue Feb 10 13:26:00 2009 -0600
+++ b/hgext/mq.py	Tue Feb 10 15:53:22 2009 -0600
@@ -1994,12 +1994,10 @@
     With no arguments, print the currently active guards.
     With arguments, set guards for the named patch.
 
-    To set a negative guard "-foo" on topmost patch ("--" is needed so
-    hg will not interpret "-foo" as an option):
-      hg qguard -- -foo
+    NOTE: Specifying negative guards now requires '--'.
 
     To set guards on another patch:
-      hg qguard other.patch +2.6.17 -stable
+      hg qguard -- other.patch +2.6.17 -stable
     '''
     def status(idx):
         guards = q.series_guards[idx] or ['unguarded']
@@ -2499,7 +2497,7 @@
         (guard,
          [('l', 'list', None, _('list all patches and guards')),
           ('n', 'none', None, _('drop all guards'))],
-         _('hg qguard [-l] [-n] [PATCH] [+GUARD]... [-GUARD]...')),
+         _('hg qguard [-l] [-n] -- [PATCH] [+GUARD]... [-GUARD]...')),
     'qheader': (header, [], _('hg qheader [PATCH]')),
     "^qimport":
         (qimport,


-- 
http://selenic.com : development and support for Mercurial and Linux




More information about the Mercurial-devel mailing list