Commits

Yuya Nishihara committed f814ad9

manifestmodel: remove unnecessary function nesting from drag handler

  • Participants
  • Parent commits eaa0dec

Comments (0)

Files changed (1)

tortoisehg/hgqt/manifestmodel.py

         return e.isdir
 
     def mimeData(self, indexes):
-        def preparefiles():
-            files = [self.filePath(i) for i in indexes if i.isValid()]
-            if self._rev is not None:
-                lfiles = map(hglib.fromunicode, files)
-                base, _fns = visdiff.snapshot(self._repo, lfiles,
-                                              self._repo[self._rev])
-            else:  # working copy
-                base = self._repo.root
-            return iter(os.path.join(hglib.tounicode(base), e) for e in files)
+        files = [self.filePath(i) for i in indexes if i.isValid()]
+        if self._rev is not None:
+            lfiles = map(hglib.fromunicode, files)
+            lbase, _fns = visdiff.snapshot(self._repo, lfiles,
+                                           self._repo[self._rev])
+        else:
+            # working copy
+            lbase = self._repo.root
+        base = hglib.tounicode(lbase)
 
         m = QMimeData()
-        m.setUrls([QUrl.fromLocalFile(e) for e in preparefiles()])
+        m.setUrls([QUrl.fromLocalFile(os.path.join(base, e)) for e in files])
         return m
 
     def mimeTypes(self):