Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 1.9, 1.9.1, and 1.9.2

manifestdialog: accept initial path, line and pattern from command-line

Changeset 3656bbf7cf9b

Parent d14eff2351a3

by Yuya Nishihara

Changes to 2 files · Browse files at 3656bbf7cf9b Showing diff from parent d14eff2351a3 Diff from another changeset...

 
80
81
82
 
 
 
 
 
 
 
83
84
85
 
329
330
331
332
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
80
81
82
83
84
85
86
87
88
89
90
91
92
 
336
337
338
 
339
340
341
342
343
344
345
346
347
348
349
350
351
352
@@ -80,6 +80,13 @@
  s.setValue('manifest/splitter',   self._manifest_widget._splitter.saveState())   + def setSource(self, path, rev, line=None): + self._manifest_widget.setSource(path, rev, line) + + def setSearchPattern(self, text): + """Set search pattern [unicode]""" + self._searchbar.setPattern(text) +   @pyqtSlot(unicode, dict)   def _openSearchWidget(self, pattern, opts):   opts = dict((str(k), str(v)) for k, v in opts.iteritems()) @@ -329,4 +336,17 @@
   def run(ui, *pats, **opts):   repo = opts.get('repo') or thgrepo.repository(ui, paths.find_root()) - return ManifestDialog(ui, repo, opts.get('rev')) + dlg = ManifestDialog(ui, repo, opts.get('rev')) + + # set initial state after dialog visible + def init(): + try: + path = hglib.canonpaths(pats)[0] + line = opts.get('line') and int(opts['line']) or None + dlg.setSource(path, opts.get('rev'), line) + except IndexError: + pass + dlg.setSearchPattern(hglib.tounicode(opts.get('pattern')) or '') + QTimer.singleShot(0, init) + + return dlg
 
903
904
905
906
907
 
 
 
 
908
909
910
 
903
904
905
 
 
906
907
908
909
910
911
912
@@ -903,8 +903,10 @@
  _('thg log [OPTIONS] [FILE]')),   "manifest":   (manifest, - [('r', 'rev', '', _('revision to display'))], - _('thg manifest [-r REV]')), + [('r', 'rev', '', _('revision to display')), + ('n', 'line', '', _('open to line')), + ('p', 'pattern', '', _('initial search pattern'))], + _('thg manifest [-r REV] [FILE]')),   "^merge":   (merge,   [('r', 'rev', '', _('revision to merge'))],