Commits

Yuya Nishihara committed 17ef4b4 Draft

filectxactions: simply look up file name and revision from file data

Comments (0)

Files changed (1)

tortoisehg/hgqt/filectxactions.py

         if self._curfd.isNull():
             return
         repo = self._fdRepoAgent().rawRepo()
-        filenames = _lcanonpaths(self._selfds)
-        rev = self._curfd.rev()
 
-        for curfile in filenames:
-            wfile = util.localpath(curfile)
+        for fd in self._selfds:
+            wfile = hglib.fromunicode(fd.absoluteFilePath())
             wfile, ext = os.path.splitext(os.path.basename(wfile))
             extfilter = [_("All files (*)")]
             if wfile:
-                filename = "%s@%d%s" % (wfile, rev, ext)
+                filename = "%s@%d%s" % (wfile, fd.rev(), ext)
                 if ext:
                     extfilter.insert(0, "*%s" % ext)
             else:
-                filename = "%s@%d" % (ext, rev)
+                filename = "%s@%d" % (ext, fd.rev())
 
             result = QFileDialog.getSaveFileName(
                 self.parent(), _("Save file to"), hglib.tounicode(filename),
             try:
                 os.chdir(repo.root)
                 try:
-                    commands.cat(repo.ui, repo, curfile, rev=rev,
+                    curfile = hglib.fromunicode(fd.canonicalFilePath())
+                    commands.cat(repo.ui, repo, curfile, rev=fd.rev(),
                                  output=hglib.fromunicode(result))
                 except (util.Abort, IOError), e:
                     QMessageBox.critical(self.parent(),