Patchwork [31,of,35] hgk: define inferrepo in command decorator

login
register
mail settings
Submitter Gregory Szorc
Date May 5, 2014, 5:51 a.m.
Message ID <1147aa709176463125d2.1399269096@vm-ubuntu-main.gateway.sonic.net>
Download mbox | patch
Permalink /patch/4622/
State Accepted
Commit 82bf4d89e06842286d2314e4ab6b4252c41d70cc
Headers show

Comments

Gregory Szorc - May 5, 2014, 5:51 a.m.
# HG changeset patch
# User Gregory Szorc <gregory.szorc@gmail.com>
# Date 1399268002 25200
#      Sun May 04 22:33:22 2014 -0700
# Branch stable
# Node ID 1147aa709176463125d21847f023445db55c20ba
# Parent  9a7249952af9dbe31fc5b922b7d275da07b4fe5f
hgk: define inferrepo in command decorator

Patch

diff --git a/hgext/hgk.py b/hgext/hgk.py
--- a/hgext/hgk.py
+++ b/hgext/hgk.py
@@ -45,17 +45,18 @@  testedwith = 'internal'
 
 @command('debug-diff-tree',
     [('p', 'patch', None, _('generate patch')),
     ('r', 'recursive', None, _('recursive')),
     ('P', 'pretty', None, _('pretty')),
     ('s', 'stdin', None, _('stdin')),
     ('C', 'copy', None, _('detect copies')),
     ('S', 'search', "", _('search'))],
-    ('hg git-diff-tree [OPTION]... NODE1 NODE2 [FILE]...'))
+    ('hg git-diff-tree [OPTION]... NODE1 NODE2 [FILE]...'),
+    inferrepo=True)
 def difftree(ui, repo, node1=None, node2=None, *files, **opts):
     """diff trees from two commits"""
     def __difftree(repo, node1, node2, files=[]):
         assert node2 is not None
         mmap = repo[node1].manifest()
         mmap2 = repo[node2].manifest()
         m = scmutil.match(repo[node1], files)
         modified, added, removed  = repo.status(node1, node2, m)[:3]
@@ -140,17 +141,18 @@  def base(ui, repo, node1, node2):
     """output common ancestor information"""
     node1 = repo.lookup(node1)
     node2 = repo.lookup(node2)
     n = repo.changelog.ancestor(node1, node2)
     ui.write(short(n) + "\n")
 
 @command('debug-cat-file',
     [('s', 'stdin', None, _('stdin'))],
-    _('hg debug-cat-file [OPTION]... TYPE FILE'))
+    _('hg debug-cat-file [OPTION]... TYPE FILE'),
+    inferrepo=True)
 def catfile(ui, repo, type=None, r=None, **opts):
     """cat a specific revision"""
     # in stdin mode, every line except the commit is prefixed with two
     # spaces.  This way the our caller can find the commit without magic
     # strings
     #
     prefix = ""
     if opts['stdin']:
@@ -339,10 +341,8 @@  def config(ui, repo, **opts):
     _('hg view [-l LIMIT] [REVRANGE]'))
 def view(ui, repo, *etc, **opts):
     "start interactive history viewer"
     os.chdir(repo.root)
     optstr = ' '.join(['--%s %s' % (k, v) for k, v in opts.iteritems() if v])
     cmd = ui.config("hgk", "path", "hgk") + " %s %s" % (optstr, " ".join(etc))
     ui.debug("running %s\n" % cmd)
     util.system(cmd)
-
-commands.inferrepo += " debug-diff-tree debug-cat-file"