Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 2.0, 2.0.1, and 2.0.2

stable pbranch: Provide tool-button for editing pgraph

Changeset 96d0577fea47

Parent 008dc074d269

by Peer Sommerlund

Changes to one file · Browse files at 96d0577fea47 Showing diff from parent 008dc074d269 Diff from another changeset...

 
8
9
10
11
 
12
13
14
 
81
82
83
84
85
 
 
86
87
88
 
104
105
106
107
108
109
110
111
 
423
424
425
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
426
427
428
 
8
9
10
 
11
12
13
14
 
81
82
83
 
 
84
85
86
87
88
 
104
105
106
 
 
107
108
109
 
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
@@ -8,7 +8,7 @@
 import os  import time   -from mercurial import extensions, ui +from mercurial import extensions, ui, error    from tortoisehg.hgqt.i18n import _  from tortoisehg.hgqt import qtlib, cmdui, update @@ -81,8 +81,8 @@
  self.actionEditPGraph = a = QWidgetAction(self)   a.setIcon(geticon("log")) #STOCK_EDIT   a.setToolTip(_('Edit patch dependency graph')) - #tb.addAction(self.actionEditPGraph) - #self.actionEditPGraph.triggered.connect(self.pbackout_clicked) + tb.addAction(self.actionEditPGraph) + self.actionEditPGraph.triggered.connect(self.edit_pgraph_clicked)     vbox.addWidget(self.toolBar_patchbranch, 1)   @@ -104,8 +104,6 @@
  self.runner.progress.connect(self.progress)   self.runner.makeLogVisible.connect(self.makeLogVisible)   self.runner.commandFinished.connect(self.commandFinished) - self.runner.hide() - vbox.addWidget(self.runner)     def reload(self):   'User has requested a reload' @@ -423,6 +421,32 @@
  def pnew_clicked(self, toolbutton):   self.pnew_ui()   + def edit_pgraph_clicked(self): + opts = {} # TODO: How to find user ID + mgr = self.pbranch.patchmanager(self.repo.ui, self.repo, opts) + oldtext = mgr.graphdesc() + # run editor in the repository root + olddir = os.getcwd() + os.chdir(self.repo.root) + try: + newtext = None + newtext = self.repo.ui.edit(oldtext, opts.get('user')) + except error.Abort: + no_editor_configured =(os.environ.get("HGEDITOR") or + self.repo.ui.config("ui", "editor") or + os.environ.get("VISUAL") or + os.environ.get("EDITOR","editor-not-configured") + == "editor-not-configured") + if no_editor_configured: + qtlib.ErrorMsgBox( + _('No editor found'), + _('Mercurial was unable to find an editor.\nPlease configure Mercurial to use an editor installed on your system.')) + else: + raise + os.chdir(olddir) + if newtext is not None: + mgr.updategraphdesc(newtext) +   ### context menu signal handlers ###     def pnew_activated(self):