Patchwork [34,of,35] mq: define inferrepo in command decorator

mail settings
Submitter Gregory Szorc
Date May 5, 2014, 5:51 a.m.
Message ID <>
Download mbox | patch
Permalink /patch/4625/
State Accepted
Commit c85a0c3537b2ada9f53ab4fa582414eb7ffb1246
Headers show


Gregory Szorc - May 5, 2014, 5:51 a.m.
# HG changeset patch
# User Gregory Szorc <>
# Date 1399267847 25200
#      Sun May 04 22:30:47 2014 -0700
# Branch stable
# Node ID 39951943062ce591b534e83d1e4c8dcac9a6f135
# Parent  c7ff4caa9f4e8e7bb166537a29f5193b2fa1c9ce
mq: define inferrepo in command decorator


diff --git a/hgext/ b/hgext/
--- a/hgext/
+++ b/hgext/
@@ -2301,17 +2301,18 @@  def clone(ui, source, dest=None, **opts)
             strip(ui, repo, [qbase], update=False, backup=None)
         if not opts.get('noupdate'):
             ui.note(_('updating destination repository\n'))
             hg.update(repo, repo.changelog.tip())
-         _('hg qcommit [OPTION]... [FILE]...'))
+         _('hg qcommit [OPTION]... [FILE]...'),
+         inferrepo=True)
 def commit(ui, repo, *pats, **opts):
     """commit changes in the queue repository (DEPRECATED)
     This command is deprecated; use :hg:`commit --mq` instead."""
     q =
     r = q.qrepo()
     if not r:
         raise util.Abort('no queue repository')
@@ -2384,17 +2385,18 @@  def setupheaderopts(ui, opts):
           ('g', 'git', None, _('use git extended diff format')),
           ('U', 'currentuser', None, _('add "From: <current user>" to patch')),
           ('u', 'user', '',
            _('add "From: <USER>" to patch'), _('USER')),
           ('D', 'currentdate', None, _('add "Date: <current date>" to patch')),
           ('d', 'date', '',
            _('add "Date: <DATE>" to patch'), _('DATE'))
           ] + commands.walkopts + commands.commitopts,
-         _('hg qnew [-e] [-m TEXT] [-l FILE] PATCH [FILE]...'))
+         _('hg qnew [-e] [-m TEXT] [-l FILE] PATCH [FILE]...'),
+         inferrepo=True)
 def new(ui, repo, patch, *args, **opts):
     """create a new patch
     qnew creates a new patch on top of the currently-applied patch (if
     any). The patch will be initialized with any outstanding changes
     in the working directory. You may also use -I/--include,
     -X/--exclude, and/or a list of files after the patch name to add
     only changes to matching files to the new patch, leaving the rest
@@ -2438,17 +2440,18 @@  def new(ui, repo, patch, *args, **opts):
            _('add/update author field in patch with current user')),
           ('u', 'user', '',
            _('add/update author field in patch with given user'), _('USER')),
           ('D', 'currentdate', None,
            _('add/update date field in patch with current date')),
           ('d', 'date', '',
            _('add/update date field in patch with given date'), _('DATE'))
           ] + commands.walkopts + commands.commitopts,
-         _('hg qrefresh [-I] [-X] [-e] [-m TEXT] [-l FILE] [-s] [FILE]...'))
+         _('hg qrefresh [-I] [-X] [-e] [-m TEXT] [-l FILE] [-s] [FILE]...'),
+         inferrepo=True)
 def refresh(ui, repo, *pats, **opts):
     """update the current patch
     If any file patterns are provided, the refreshed patch will
     contain only the modifications that match those patterns; the
     remaining modifications will remain in the working directory.
     If -s/--short is specified, files currently included in the patch
@@ -2484,17 +2487,18 @@  def refresh(ui, repo, *pats, **opts):
         ret = q.refresh(repo, pats, msg=message, **opts)
         return ret
          commands.diffopts + commands.diffopts2 + commands.walkopts,
-         _('hg qdiff [OPTION]... [FILE]...'))
+         _('hg qdiff [OPTION]... [FILE]...'),
+         inferrepo=True)
 def diff(ui, repo, *pats, **opts):
     """diff of the current patch and subsequent modifications
     Shows a diff which includes the current patch as well as any
     changes which have been made in the working directory since the
     last refresh (thus showing what the current patch would become
     after a qrefresh).
@@ -3448,10 +3452,8 @@  def extsetup(ui):
 colortable = {'qguard.negative': 'red',
               'qguard.positive': 'yellow',
               'qguard.unguarded': 'green',
               'qseries.applied': 'blue bold underline',
               'qseries.guarded': 'black bold',
               'qseries.missing': 'red bold',
               'qseries.unapplied': 'black bold'}
-commands.inferrepo += " qnew qrefresh qdiff qcommit"