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

revdetails, manifest: added explore and terminal subrepo contextmenu actions

This patch also improves the subrepo context menu detection, so that nested
subrepos are properly detected as well.

Changeset fa65bfcc3049

Parent 634c316c4e3e

by Angel Ezquerra

Changes to 2 files · Browse files at fa65bfcc3049 Showing diff from parent 634c316c4e3e Diff from another changeset...

 
192
193
194
 
 
 
 
 
 
 
195
196
197
 
278
279
280
 
 
 
 
 
 
 
 
 
 
281
282
283
 
287
288
289
290
 
 
291
292
293
 
295
296
297
298
 
 
 
299
300
301
302
303
 
304
305
306
 
192
193
194
195
196
197
198
199
200
201
202
203
204
 
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
 
304
305
306
 
307
308
309
310
311
 
313
314
315
 
316
317
318
319
320
321
322
 
323
324
325
326
@@ -192,6 +192,13 @@
  ('opensubrepo', _('Open subrepository'), 'thg-repository-open',   'Alt+Ctrl+O', _('Open the selected subrepository'),   self.opensubrepo), + ('explore', _('Explore subrepository'), 'system-file-manager', + 'Alt+Ctrl+E', _('Open the selected subrepository'), + self.explore), + ('terminal', _('Open terminal in subrepository'), + 'utilities-terminal', 'Alt+Ctrl+T', + _('Open a shell terminal in the selected subrepository root'), + self.terminal),   ]:   act = QAction(desc, self)   if icon: @@ -278,6 +285,16 @@
  _("Cannot open subrepository"),   _("The selected subrepository does not exist on the working directory"))   + def explore(self): + root = os.path.join(self._repo.root, self.path) + if os.path.isdir(root): + QDesktopServices.openUrl(QUrl.fromLocalFile(root)) + + def terminal(self): + root = os.path.join(self._repo.root, self.path) + if os.path.isdir(root): + qtlib.openshell(root) +   def showEvent(self, event):   QWidget.showEvent(self, event)   if self._selectedrev != self._rev: @@ -287,7 +304,8 @@
    #@pyqtSlot(QModelIndex)   def onDoubleClick(self, index): - itemissubrepo = self.path in self._repo[self._rev].substate.keys() + currentindex = self._treeview.currentIndex() + itemissubrepo = (self._treemodel.fileStatus(currentindex) == 'S')   if itemissubrepo:   self.opensubrepo()   else: @@ -295,12 +313,14 @@
    def menuRequest(self, point):   point = self.mapToGlobal(point) - itemissubrepo = self.path in self._repo[self._rev].substate.keys() + + currentindex = self._treeview.currentIndex() + itemissubrepo = (self._treemodel.fileStatus(currentindex) == 'S')     # Subrepos and regular items have different context menus   if itemissubrepo:   contextmenu = self.subrepocontextmenu - actionlist = ['opensubrepo'] + actionlist = ['opensubrepo', 'explore', 'terminal']   else:   contextmenu = self.filecontextmenu   actionlist = ['diff', 'ldiff', 'edit', 'ledit', 'revert',
 
237
238
239
 
 
 
 
 
 
 
240
241
242
 
360
361
362
 
 
 
 
 
 
 
 
 
 
363
364
365
 
380
381
382
383
 
384
385
386
 
237
238
239
240
241
242
243
244
245
246
247
248
249
 
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
 
397
398
399
 
400
401
402
403
@@ -237,6 +237,13 @@
  ('opensubrepo', _('Open subrepository'), 'thg-repository-open',   'Alt+Ctrl+O', _('Open the selected subrepository'),   self.opensubrepo), + ('explore', _('Explore subrepository'), 'system-file-manager', + 'Alt+Ctrl+E', _('Open the selected subrepository'), + self.explore), + ('terminal', _('Open terminal in subrepository'), + 'utilities-terminal', 'Alt+Ctrl+T', + _('Open a shell terminal in the selected subrepository root'), + self.terminal),   ]:   act = QAction(desc, self)   if icon: @@ -360,6 +367,16 @@
  _("Cannot open subrepository"),   _("The selected subrepository does not exist on the working directory"))   + def explore(self): + root = os.path.join(self.repo.root, self.filelist.currentFile()) + if os.path.isdir(root): + QDesktopServices.openUrl(QUrl.fromLocalFile(root)) + + def terminal(self): + root = os.path.join(self.repo.root, self.filelist.currentFile()) + if os.path.isdir(root): + qtlib.openshell(root) +   #@pyqtSlot(QModelIndex)   def onDoubleClick(self, index):   model = self.filelist.model() @@ -380,7 +397,7 @@
  # Subrepos and regular items have different context menus   if itemissubrepo:   contextmenu = self.subrepocontextmenu - actionlist = ['opensubrepo'] + actionlist = ['opensubrepo', 'explore', 'terminal']   else:   contextmenu = self.filecontextmenu   actionlist = ['diff', 'ldiff', 'edit', 'ledit', 'revert',