Steve Borho avatar Steve Borho committed eecb02b

fileview: connect editSelected from the annotate widget

Comments (0)

Files changed (1)

tortoisehg/hgqt/fileview.py

 from tortoisehg.util import hglib, patchctx
 from tortoisehg.hgqt.i18n import _
 from tortoisehg.hgqt import annotate, qscilib, qtlib, blockmatcher, lexers
+from tortoisehg.hgqt import visdiff, wctxactions
 
 qsci = Qsci.QsciScintilla
 
     searchRequested = pyqtSignal(unicode)
     """Emitted (pattern) when user request to search content"""
 
-    editSelected = pyqtSignal(unicode, object, int)
-    """Emitted (path, rev, line) when user requests to open editor"""
-
     grepRequested = pyqtSignal(unicode, dict)
     """Emitted (pattern, opts) when user request to search changelog"""
 
     def sourceChanged(self, path, rev, line=None):
         self.revForDiffChanged.emit(rev)
 
+    @pyqtSlot(unicode, object, int)
+    def editSelected(self, path, rev, line):
+        """Open editor to show the specified file"""
+        repo = self._ctx._repo
+        path = hglib.fromunicode(path)
+        base = visdiff.snapshot(repo, [path], repo[rev])[0]
+        files = [os.path.join(base, path)]
+        wctxactions.edit(self, repo.ui, repo, files, line, self._find_text)
+
     def searchString(self, text):
         self._find_text = text
         self.clearHighlights()
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.