Updates for Mercurial 3.8(?) API compatibility, which broadly broke extensions by forcing @commands decoration.
authorSean E. Russell <sean.russell@internationalsos.com>
Wed, 15 Mar 2017 08:30:12 -0400
changeset 89 c844431600df
parent 88 14472fccbe89
child 90 979145ac3ccc
Updates for Mercurial 3.8(?) API compatibility, which broadly broke extensions by forcing @commands decoration.
artemis/find.py
artemis/list.py
artemis/main.py
--- a/artemis/find.py	Thu Dec 01 11:27:33 2016 -0800
+++ b/artemis/find.py	Wed Mar 15 08:30:12 2017 -0400
@@ -78,8 +78,8 @@
                              'Like comparison is used if exact is'
                              'uspecified.'),
     ]
+    usage = 'hg ifind [OPTIONS] QUERY'
 
-    usage = 'hg ifind [OPTIONS] QUERY'
     ui = None
     repo = None
     opts = []
--- a/artemis/list.py	Thu Dec 01 11:27:33 2016 -0800
+++ b/artemis/list.py	Wed Mar 15 08:30:12 2017 -0400
@@ -29,7 +29,6 @@
                             '' % (Artemis.default_issues_dir,
                                   Artemis.filter_prefix))
     ]
-
     usage = 'hg ilist [OPTIONS]'
 
     def __init__(self):
--- a/artemis/main.py	Thu Dec 01 11:27:33 2016 -0800
+++ b/artemis/main.py	Wed Mar 15 08:30:12 2017 -0400
@@ -1,7 +1,7 @@
 #!/usr/bin/env python
 # -*- coding: utf-8 -*-
 
-from mercurial import hg, util, commands
+from mercurial import hg, util, commands, cmdutil
 from mercurial.i18n import _
 import sys, os, time, random, mailbox, glob, socket, ConfigParser
 import mimetypes
@@ -23,20 +23,28 @@
 __date__ = '2016/03/02'
 
 
-cmdtable = {
-    'ilist' : (ArtemisList().list,
-               ArtemisList.commands,
-               _(ArtemisList.usage)),
-    'iadd'  : (ArtemisAdd().add,
-               ArtemisAdd.commands,
-               _(ArtemisAdd.usage)),
-    'ishow' : (ArtemisShow().show,
-               ArtemisShow.commands,
-               _(ArtemisShow.usage)),
-    'ifind' : (ArtemisFind().find,
-              ArtemisFind.commands,
-              _(ArtemisFind.usage)),
-}
+cmdtable = {}
+command = cmdutil.command(cmdtable)
+
+@command('ifind', ArtemisFind.commands, ArtemisFind.usage)
+def find(ui, repo, id=None, **opts):
+    '''find issues'''
+    return ArtemisFind().find(ui, repo, id, opts)
+
+@command('ishow', ArtemisShow.commands, ArtemisShow.usage)
+def show(ui, repo, id=None, **opts):
+    '''show issue details'''
+    return ArtemisShow().show(ui, repo, id, opts)
+
+@command('ilist', ArtemisList.commands, ArtemisList.usage)
+def list(ui, repo, id=None, **opts):
+    '''list issues'''
+    return ArtemisList().list(ui, repo, **opts)
+
+@command('iadd', ArtemisAdd.commands, ArtemisAdd.usage)
+def add(ui, repo, id=None, **opts):
+    '''add / edit issues'''
+    return ArtemisAdd().add(ui, repo, id, opts)
 
 if __name__ == "__main__":
     pass