Changeset ceb6119bdfa4…
Parent b38306779932…
by
Changes to 6 files · Browse files at ceb6119bdfa4 Showing diff from parent b38306779932 Diff from another changeset...
@@ -14,11 +14,9 @@ from PyQt4.Qsci import QsciScintilla, QsciAPIs, QsciLexerMakefile
from tortoisehg.hgqt.i18n import _
-from tortoisehg.util import hglib, shlib, wconfig
+from tortoisehg.util import hglib, shlib, wconfig, bugtraq
from tortoisehg.hgqt import qtlib, qscilib, status, cmdui, branchop, revpanel
-from tortoisehg.hgtk import bugtraq
-
# Technical Debt for CommitWidget
# disable commit button while no message is entered or no files are selected
# qtlib decode failure dialog (ask for retry locale, suggest HGENCODING)
|
@@ -9,12 +9,10 @@
from mercurial import ui, util, error
-from tortoisehg.util import hglib, settings, paths, wconfig, i18n
+from tortoisehg.util import hglib, settings, paths, wconfig, i18n, bugtraq
from tortoisehg.hgqt.i18n import _
from tortoisehg.hgqt import qtlib, qscilib, thgrepo
-from tortoisehg.hgtk import bugtraq
-
from PyQt4.QtCore import *
from PyQt4.QtGui import *
|
|
|
@@ -1,172 +0,0 @@ - from ctypes import *
-import comtypes
-import pythoncom
-from comtypes import IUnknown, GUID, COMMETHOD, POINTER
-from comtypes.typeinfo import ITypeInfo
-from comtypes.client import CreateObject
-from comtypes.automation import _midlSAFEARRAY
-from _winreg import *
-
-class IBugTraqProvider(IUnknown):
- _iid_ = GUID("{298B927C-7220-423C-B7B4-6E241F00CD93}")
- _methods_ = [
- COMMETHOD([], HRESULT, "ValidateParameters",
- (['in'], comtypes.c_long, "hParentWnd"),
- (['in'], comtypes.BSTR, "parameters"),
- (['out', 'retval'], POINTER(comtypes.c_int16), "pRetVal") ),
- COMMETHOD([], HRESULT, "GetLinkText",
- (['in'], comtypes.c_long, "hParentWnd"),
- (['in'], comtypes.BSTR, "parameters"),
- (['out', 'retval'], POINTER(comtypes.BSTR), "pRetVal") ),
- COMMETHOD([], HRESULT, "GetCommitMessage",
- (['in'], comtypes.c_long, "hParentWnd"),
- (['in'], comtypes.BSTR, "parameters"),
- (['in'], comtypes.BSTR, "commonRoot"),
- (['in'], _midlSAFEARRAY(comtypes.BSTR), "pathList"),
- (['in'], comtypes.BSTR, "originalMessage"),
- (['out', 'retval'], POINTER(comtypes.BSTR), "pRetVal") )
- ]
-
-class IBugTraqProvider2(IBugTraqProvider):
- _iid_ = GUID("{C5C85E31-2F9B-4916-A7BA-8E27D481EE83}")
- _methods_ = [
- COMMETHOD([], HRESULT, "GetCommitMessage2",
- (['in'], comtypes.c_long, "hParentWnd"),
- (['in'], comtypes.BSTR, "parameters"),
- (['in'], comtypes.BSTR, "commonURL"),
- (['in'], comtypes.BSTR, "commonRoot"),
- (['in'], _midlSAFEARRAY(comtypes.BSTR), "pathList"),
- (['in'], comtypes.BSTR, "originalMessage"),
- (['in'], comtypes.BSTR, "bugID"),
- (['out'], POINTER(comtypes.BSTR), "bugIDOut"),
- (['out'], POINTER(_midlSAFEARRAY(comtypes.BSTR)), "revPropNames"),
- (['out'], POINTER(_midlSAFEARRAY(comtypes.BSTR)), "revPropValues"),
- (['out', 'retval'], POINTER(comtypes.BSTR), "pRetVal") ),
- COMMETHOD([], HRESULT, "CheckCommit",
- (['in'], comtypes.c_long, "hParentWnd"),
- (['in'], comtypes.BSTR, "parameters"),
- (['in'], comtypes.BSTR, "commonURL"),
- (['in'], comtypes.BSTR, "commonRoot"),
- (['in'], _midlSAFEARRAY(comtypes.BSTR), "pathList"),
- (['in'], comtypes.BSTR, "commitMessage"),
- (['out', 'retval'], POINTER(comtypes.BSTR), "pRetVal") ),
- COMMETHOD([], HRESULT, "OnCommitFinished",
- (['in'], comtypes.c_long, "hParentWnd"),
- (['in'], comtypes.BSTR, "commonRoot"),
- (['in'], _midlSAFEARRAY(comtypes.BSTR), "pathList"),
- (['in'], comtypes.BSTR, "logMessage"),
- (['in'], comtypes.c_long, "revision"),
- (['out', 'retval'], POINTER(comtypes.BSTR), "pRetVal") ),
- COMMETHOD([], HRESULT, "HasOptions",
- (['out', 'retval'], POINTER(comtypes.c_int16), "pRetVal") ),
- COMMETHOD([], HRESULT, "ShowOptionsDialog",
- (['in'], comtypes.c_long, "hParentWnd"),
- (['in'], comtypes.BSTR, "parameters"),
- (['out', 'retval'], POINTER(comtypes.BSTR), "pRetVal") )
- ]
-
-
-class BugTraq:
- #svnjiraguid = "{CF732FD7-AA8A-4E9D-9E15-025E4D1A7E9D}"
-
- def __init__(self, guid):
- self.guid = guid
- self.bugtr = None
-
- def _get_bugtraq_object(self):
- if self.bugtr == None:
- obj = CreateObject(self.guid)
- try:
- self.bugtr = obj.QueryInterface(IBugTraqProvider2)
- except COMError:
- return None
- return self.bugtr
-
- def get_commit_message(self, parameters, logmessage):
- commonurl = ""
- commonroot = ""
- bugid = ""
- bstrarray = _midlSAFEARRAY(comtypes.BSTR)
- pathlist = bstrarray.from_param(())
-
- bugtr = self._get_bugtraq_object()
- if self.supports_bugtraq2_interface():
- (bugid, revPropNames, revPropValues, newmessage) = bugtr.GetCommitMessage2(
- 0, parameters, commonurl, commonroot, pathlist, logmessage, bugid)
- else:
- newmessage = bugtr.GetCommitMessage(
- 0, parameters, commonroot, pathlist, logmessage)
-
- return newmessage
-
- def on_commit_finished(self, logmessage):
- if not self.supports_bugtraq2_interface():
- return ""
-
- commonroot = ""
- bstrarray = _midlSAFEARRAY(comtypes.BSTR)
- pathlist = bstrarray.from_param(())
-
- bugtr = self._get_bugtraq_object()
- errormessage = bugtr.OnCommitFinished(0, commonroot, pathlist,
- logmessage, 0)
- return errormessage
-
- def show_options_dialog(self, options):
- if not self.has_options():
- return ""
-
- bugtr = self._get_bugtraq_object()
- options = bugtr.ShowOptionsDialog(0, options)
- return options
-
- def has_options(self):
- if not self.supports_bugtraq2_interface():
- return False
-
- bugtr = self._get_bugtraq_object()
- return bugtr.HasOptions() != 0
-
- def get_link_text(self, parameters):
- bugtr = self._get_bugtraq_object()
- return bugtr.GetLinkText(0, parameters)
-
- def supports_bugtraq2_interface(self):
- bugtr = self._get_bugtraq_object()
- try:
- bugtr.HasOptions()
- return True
- except (ValueError, AttributeError):
- return False
-
-
-def get_issue_plugins():
- cm = pythoncom.CoCreateInstance(pythoncom.CLSID_StdComponentCategoriesMgr,
- None, pythoncom.CLSCTX_INPROC,pythoncom.IID_ICatInformation)
- CATID_BugTraqProvider = pythoncom.MakeIID(
- "{3494FA92-B139-4730-9591-01135D5E7831}")
- ret = []
- enumerator = cm.EnumClassesOfCategories((CATID_BugTraqProvider,),())
- while 1:
- try:
- clsid = enumerator.Next()
- if clsid == ():
- break
- except pythoncom.com_error:
- break
- ret.extend(clsid)
- return ret
-
-def get_plugin_name(clsid):
- key = OpenKey(HKEY_CLASSES_ROOT, r"CLSID\%s" % clsid)
- try:
- keyvalue = QueryValueEx(key, None)[0]
- except WindowsError:
- keyvalue = None
- key.Close()
- return keyvalue
-
-def get_issue_plugins_with_names():
- pluginclsids = get_issue_plugins()
- keyandnames = [(key, get_plugin_name(key)) for key in pluginclsids]
- return [kn for kn in keyandnames if kn[1] is not None]
|
@@ -20,7 +20,7 @@ from mercurial import hg, util, patch, cmdutil, extensions
from tortoisehg.util.i18n import _
-from tortoisehg.util import shlib, hglib, i18n
+from tortoisehg.util import shlib, hglib, i18n, bugtraq
keep = i18n.keepgettext()
@@ -28,7 +28,6 @@from tortoisehg.hgtk.status import FM_PATH, FM_PATH_UTF8
from tortoisehg.hgtk import csinfo, gtklib, thgconfig, gdialog, hgcmd
from tortoisehg.hgtk import thgmq, textview
-from tortoisehg.hgtk import bugtraq
class BranchOperationDialog(gtk.Dialog):
def __init__(self, branch, close, repo):
|
@@ -19,7 +19,7 @@ from tortoisehg.hgtk import dialog, gdialog, gtklib, hgcmd
try:
- from tortoisehg.hgtk import bugtraq
+ from tortoisehg.util import bugtraq
bugtraq.get_issue_plugins_with_names()
except ImportError:
bugtraq = None
|
|
|
@@ -0,0 +1,172 @@ + from ctypes import *
+import comtypes
+import pythoncom
+from comtypes import IUnknown, GUID, COMMETHOD, POINTER
+from comtypes.typeinfo import ITypeInfo
+from comtypes.client import CreateObject
+from comtypes.automation import _midlSAFEARRAY
+from _winreg import *
+
+class IBugTraqProvider(IUnknown):
+ _iid_ = GUID("{298B927C-7220-423C-B7B4-6E241F00CD93}")
+ _methods_ = [
+ COMMETHOD([], HRESULT, "ValidateParameters",
+ (['in'], comtypes.c_long, "hParentWnd"),
+ (['in'], comtypes.BSTR, "parameters"),
+ (['out', 'retval'], POINTER(comtypes.c_int16), "pRetVal") ),
+ COMMETHOD([], HRESULT, "GetLinkText",
+ (['in'], comtypes.c_long, "hParentWnd"),
+ (['in'], comtypes.BSTR, "parameters"),
+ (['out', 'retval'], POINTER(comtypes.BSTR), "pRetVal") ),
+ COMMETHOD([], HRESULT, "GetCommitMessage",
+ (['in'], comtypes.c_long, "hParentWnd"),
+ (['in'], comtypes.BSTR, "parameters"),
+ (['in'], comtypes.BSTR, "commonRoot"),
+ (['in'], _midlSAFEARRAY(comtypes.BSTR), "pathList"),
+ (['in'], comtypes.BSTR, "originalMessage"),
+ (['out', 'retval'], POINTER(comtypes.BSTR), "pRetVal") )
+ ]
+
+class IBugTraqProvider2(IBugTraqProvider):
+ _iid_ = GUID("{C5C85E31-2F9B-4916-A7BA-8E27D481EE83}")
+ _methods_ = [
+ COMMETHOD([], HRESULT, "GetCommitMessage2",
+ (['in'], comtypes.c_long, "hParentWnd"),
+ (['in'], comtypes.BSTR, "parameters"),
+ (['in'], comtypes.BSTR, "commonURL"),
+ (['in'], comtypes.BSTR, "commonRoot"),
+ (['in'], _midlSAFEARRAY(comtypes.BSTR), "pathList"),
+ (['in'], comtypes.BSTR, "originalMessage"),
+ (['in'], comtypes.BSTR, "bugID"),
+ (['out'], POINTER(comtypes.BSTR), "bugIDOut"),
+ (['out'], POINTER(_midlSAFEARRAY(comtypes.BSTR)), "revPropNames"),
+ (['out'], POINTER(_midlSAFEARRAY(comtypes.BSTR)), "revPropValues"),
+ (['out', 'retval'], POINTER(comtypes.BSTR), "pRetVal") ),
+ COMMETHOD([], HRESULT, "CheckCommit",
+ (['in'], comtypes.c_long, "hParentWnd"),
+ (['in'], comtypes.BSTR, "parameters"),
+ (['in'], comtypes.BSTR, "commonURL"),
+ (['in'], comtypes.BSTR, "commonRoot"),
+ (['in'], _midlSAFEARRAY(comtypes.BSTR), "pathList"),
+ (['in'], comtypes.BSTR, "commitMessage"),
+ (['out', 'retval'], POINTER(comtypes.BSTR), "pRetVal") ),
+ COMMETHOD([], HRESULT, "OnCommitFinished",
+ (['in'], comtypes.c_long, "hParentWnd"),
+ (['in'], comtypes.BSTR, "commonRoot"),
+ (['in'], _midlSAFEARRAY(comtypes.BSTR), "pathList"),
+ (['in'], comtypes.BSTR, "logMessage"),
+ (['in'], comtypes.c_long, "revision"),
+ (['out', 'retval'], POINTER(comtypes.BSTR), "pRetVal") ),
+ COMMETHOD([], HRESULT, "HasOptions",
+ (['out', 'retval'], POINTER(comtypes.c_int16), "pRetVal") ),
+ COMMETHOD([], HRESULT, "ShowOptionsDialog",
+ (['in'], comtypes.c_long, "hParentWnd"),
+ (['in'], comtypes.BSTR, "parameters"),
+ (['out', 'retval'], POINTER(comtypes.BSTR), "pRetVal") )
+ ]
+
+
+class BugTraq:
+ #svnjiraguid = "{CF732FD7-AA8A-4E9D-9E15-025E4D1A7E9D}"
+
+ def __init__(self, guid):
+ self.guid = guid
+ self.bugtr = None
+
+ def _get_bugtraq_object(self):
+ if self.bugtr == None:
+ obj = CreateObject(self.guid)
+ try:
+ self.bugtr = obj.QueryInterface(IBugTraqProvider2)
+ except COMError:
+ return None
+ return self.bugtr
+
+ def get_commit_message(self, parameters, logmessage):
+ commonurl = ""
+ commonroot = ""
+ bugid = ""
+ bstrarray = _midlSAFEARRAY(comtypes.BSTR)
+ pathlist = bstrarray.from_param(())
+
+ bugtr = self._get_bugtraq_object()
+ if self.supports_bugtraq2_interface():
+ (bugid, revPropNames, revPropValues, newmessage) = bugtr.GetCommitMessage2(
+ 0, parameters, commonurl, commonroot, pathlist, logmessage, bugid)
+ else:
+ newmessage = bugtr.GetCommitMessage(
+ 0, parameters, commonroot, pathlist, logmessage)
+
+ return newmessage
+
+ def on_commit_finished(self, logmessage):
+ if not self.supports_bugtraq2_interface():
+ return ""
+
+ commonroot = ""
+ bstrarray = _midlSAFEARRAY(comtypes.BSTR)
+ pathlist = bstrarray.from_param(())
+
+ bugtr = self._get_bugtraq_object()
+ errormessage = bugtr.OnCommitFinished(0, commonroot, pathlist,
+ logmessage, 0)
+ return errormessage
+
+ def show_options_dialog(self, options):
+ if not self.has_options():
+ return ""
+
+ bugtr = self._get_bugtraq_object()
+ options = bugtr.ShowOptionsDialog(0, options)
+ return options
+
+ def has_options(self):
+ if not self.supports_bugtraq2_interface():
+ return False
+
+ bugtr = self._get_bugtraq_object()
+ return bugtr.HasOptions() != 0
+
+ def get_link_text(self, parameters):
+ bugtr = self._get_bugtraq_object()
+ return bugtr.GetLinkText(0, parameters)
+
+ def supports_bugtraq2_interface(self):
+ bugtr = self._get_bugtraq_object()
+ try:
+ bugtr.HasOptions()
+ return True
+ except (ValueError, AttributeError):
+ return False
+
+
+def get_issue_plugins():
+ cm = pythoncom.CoCreateInstance(pythoncom.CLSID_StdComponentCategoriesMgr,
+ None, pythoncom.CLSCTX_INPROC,pythoncom.IID_ICatInformation)
+ CATID_BugTraqProvider = pythoncom.MakeIID(
+ "{3494FA92-B139-4730-9591-01135D5E7831}")
+ ret = []
+ enumerator = cm.EnumClassesOfCategories((CATID_BugTraqProvider,),())
+ while 1:
+ try:
+ clsid = enumerator.Next()
+ if clsid == ():
+ break
+ except pythoncom.com_error:
+ break
+ ret.extend(clsid)
+ return ret
+
+def get_plugin_name(clsid):
+ key = OpenKey(HKEY_CLASSES_ROOT, r"CLSID\%s" % clsid)
+ try:
+ keyvalue = QueryValueEx(key, None)[0]
+ except WindowsError:
+ keyvalue = None
+ key.Close()
+ return keyvalue
+
+def get_issue_plugins_with_names():
+ pluginclsids = get_issue_plugins()
+ keyandnames = [(key, get_plugin_name(key)) for key in pluginclsids]
+ return [kn for kn in keyandnames if kn[1] is not None]
|
Loading...