Commits

Steve Borho committed 8647161 Merge

Merge with stable

Comments (0)

Files changed (2)

tortoisehg/hgqt/manifestdialog.py

 
         self.setStatusBar(QStatusBar())
         self._manifest_widget.showMessage.connect(self.statusBar().showMessage)
-        self._manifest_widget.linkActivated.connect(self.linkActivated)
+        self._manifest_widget.linkActivated.connect(self._linkHandler)
 
         self._readsettings()
         self._updatewindowtitle()
         from tortoisehg.hgqt import run
         run.grep(self._repo.ui, hglib.fromunicode(pattern), **opts)
 
+    @pyqtSlot(QString)
+    def _linkHandler(self, link):
+        ulink = unicode(link)
+        if ulink.startswith('cset:'):
+            rev = ulink[len('cset:'):]
+            self._manifest_widget.setRev(rev)
+        else:
+            self.linkActivated.emit(link)
+
+
 class ManifestWidget(QWidget, qtlib.TaskWidget):
     """Display file tree and contents at the specified revision"""
 
         if self.rev is None:
             qtlib.editfiles(self._repo, [hglib.fromunicode(self.path)],
                             parent=self)
-        else:
+        elif self.path in self._repo[self.rev]:
             base, _ = visdiff.snapshot(self._repo,
                                        [hglib.fromunicode(self.path)],
                                        self._repo[self.rev])
         if self.rev is None:
             qtlib.editfiles(self._repo, [hglib.fromunicode(self.path)],
                             parent=self)
-        else:
+        elif self.path in self._repo[self.rev]:
             base, _ = visdiff.snapshot(self._repo,
                                        [hglib.fromunicode(self.path)],
                                        self._repo[self.rev])

tortoisehg/hgqt/qtlib.py

 
 def editfiles(repo, files, lineno=None, search=None, parent=None, editor=None):
     if len(files) == 1:
-        path = repo.wjoin(files[0])
+        filename = files[0].strip()
+        if not filename:
+            return
+        files = [filename]
+        path = repo.wjoin(filename)
         cwd = os.path.dirname(path)
         files = [os.path.basename(path)]
     else: