Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 2.1, 2.1.1, and 2.1.2

commit: add IBugTraqProvider support

Changeset a80c4a9d1ca0

Parent e81c7a838b32

by Lloyd Markle

Changes to one file · Browse files at a80c4a9d1ca0 Showing diff from parent e81c7a838b32 Diff from another changeset...

 
17
18
19
 
 
20
21
22
 
188
189
190
 
 
191
192
193
 
219
220
221
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
222
223
224
 
296
297
298
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
299
300
301
 
629
630
631
 
 
632
633
634
 
17
18
19
20
21
22
23
24
 
190
191
192
193
194
195
196
197
 
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
 
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
 
672
673
674
675
676
677
678
679
@@ -17,6 +17,8 @@
 from tortoisehg.util import hglib, shlib, wconfig  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) @@ -188,6 +190,8 @@
    self.opts['pushafter'] = repo.ui.config('tortoisehg', 'cipushafter', '')   self.opts['autoinc'] = repo.ui.config('tortoisehg', 'autoinc', '') + self.opts['bugtraqplugin'] = repo.ui.config('tortoisehg', 'issue.bugtraqplugin', None) + self.opts['bugtraqparameters'] = repo.ui.config('tortoisehg', 'tortoisehg.issue.bugtraqparameters', None)     layout = QVBoxLayout()   layout.setContentsMargins(2, 2, 2, 2) @@ -219,6 +223,25 @@
    tbar.addAction(_('Options')).triggered.connect(self.details)   tbar.setIconSize(QSize(16,16)) + + if self.opts['bugtraqplugin'] != None: + self.bugtraq = self.createBugTracker() + try: + parameters = self.opts['bugtraqparameters'] + linktext = self.bugtraq.get_link_text(parameters) + except Exception, e: + tracker = self.opts['bugtraqplugin'].split(' ', 1)[1] + qtlib.ErrorMsgBox(_('Issue Tracker'), + _('Failed to load issue tracker \'%s\': %s' + % (tracker, e)), + parent=self) + self.bugtraq = None + else: + # connect UI because we have a valid bug tracker + self.commitComplete.connect(self.bugTrackerPostCommit) + tbar.addAction(linktext).triggered.connect( + self.getBugTrackerCommitMessage) +   self.stopAction = tbar.addAction(_('Stop'))   self.stopAction.triggered.connect(self.stop)   self.stopAction.setIcon(qtlib.geticon('process-stop')) @@ -296,6 +319,26 @@
  'QsciAPIs has finished parsing displayed file'   self.msgte.lexer().setAPIs(self._apis)   + def bugTrackerPostCommit(self): + # commit already happened, get last message in history + message = self.lastmessage + error = self.bugtraq.on_commit_finished(message) + if error != None and len(error) > 0: + qtlib.ErrorMsgBox(_('Issue Tracker'), error, parent=self) + # recreate bug tracker to get new COM object for next commit + self.bugtraq = self.createBugTracker() + + def createBugTracker(self): + bugtraqid = self.opts['bugtraqplugin'].split(' ', 1)[0] + result = bugtraq.BugTraq(bugtraqid) + return result + + def getBugTrackerCommitMessage(self): + parameters = self.opts['bugtraqparameters'] + message = self.getMessage() + newMessage = self.bugtraq.get_commit_message(parameters, message) + self.setMessage(newMessage) +   def details(self):   dlg = DetailsDialog(self.opts, self.userhist, self)   dlg.finished.connect(dlg.deleteLater) @@ -629,6 +672,8 @@
  self.commitButtonEnable.emit(True)   self.repo.decrementBusyCount()   if ret == 0: + # capture last message for BugTraq plugin + self.lastmessage = self.getMessage()   self.branchop = None   umsg = self.msgte.text()   if umsg: