Patchwork [3,of,3] extdiff: use @command decorator to set up diff commands

login
register
mail settings
Submitter Yuya Nishihara
Date Jan. 6, 2016, 3:31 p.m.
Message ID <92fba84837f39d19c1c9.1452094262@mimosa>
Download mbox | patch
Permalink /patch/12572/
State Accepted
Headers show

Comments

Yuya Nishihara - Jan. 6, 2016, 3:31 p.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1451655334 -32400
#      Fri Jan 01 22:35:34 2016 +0900
# Node ID 92fba84837f39d19c1c9d33b9b6c4f041c134a6a
# Parent  7cef792466ed42cf6c619992a7bbc51ab7a9c33e
extdiff: use @command decorator to set up diff commands

It can set "inferrepo" attribute appropriately.
Sean Farley - Jan. 6, 2016, 7:57 p.m.
Yuya Nishihara <yuya@tcha.org> writes:

> # HG changeset patch
> # User Yuya Nishihara <yuya@tcha.org>
> # Date 1451655334 -32400
> #      Fri Jan 01 22:35:34 2016 +0900
> # Node ID 92fba84837f39d19c1c9d33b9b6c4f041c134a6a
> # Parent  7cef792466ed42cf6c619992a7bbc51ab7a9c33e
> extdiff: use @command decorator to set up diff commands
>
> It can set "inferrepo" attribute appropriately.

Sure, why not.

Patch

diff --git a/hgext/extdiff.py b/hgext/extdiff.py
--- a/hgext/extdiff.py
+++ b/hgext/extdiff.py
@@ -369,6 +369,5 @@  use %(path)s to diff repository (or sele
             # right encoding) prevents that.
             mydiff.__doc__ = doc.decode(encoding.encoding)
             return mydiff
-        cmdtable[cmd] = (save(cmdline),
-                         extdiffopts[:],
-                         _('hg %s [OPTION]... [FILE]...') % cmd)
+        command(cmd, extdiffopts[:], _('hg %s [OPTION]... [FILE]...') % cmd,
+                inferrepo=True)(save(cmdline))