Plugins/VcsPlugins/vcsMercurial/HgLogBrowserDialog.py

changeset 3317
d7639a86e90f
parent 3315
bd1a25ead18d
child 3330
955e15f0ecce
--- a/Plugins/VcsPlugins/vcsMercurial/HgLogBrowserDialog.py	Sat Mar 01 18:36:34 2014 +0100
+++ b/Plugins/VcsPlugins/vcsMercurial/HgLogBrowserDialog.py	Sun Mar 02 15:16:44 2014 +0100
@@ -8,6 +8,7 @@
 """
 
 import os
+import re
 
 from PyQt4.QtCore import pyqtSlot, Qt, QDate, QProcess, QTimer, QRegExp, \
     QSize, QPoint
@@ -41,6 +42,10 @@
     MessageColumn = 6
     TagsColumn = 7
     
+    LargefilesCacheL = ".hglf/"
+    LargefilesCacheW = ".hglf\\"
+    PathSeparatorRe = re.compile(r"/|\\")
+    
     def __init__(self, vcs, mode="log", parent=None):
         """
         Constructor
@@ -869,6 +874,19 @@
         self.inputGroup.hide()
         self.refreshButton.setEnabled(True)
     
+    def __modifyForLargeFiles(self, filename):
+        """
+        Private method to convert the displayed file name for a large file.
+        
+        @param filename file name to be processed (string)
+        @return processed file name (string)
+        """
+        if filename.startswith((self.LargefilesCacheL, self.LargefilesCacheW)):
+            return self.tr("{0} (large file)").format(
+                self.PathSeparatorRe.split(filename, 1)[1])
+        else:
+            return filename
+    
     def __processBuffer(self):
         """
         Private method to process the buffered output of the hg log command.
@@ -904,13 +922,14 @@
                             if f in fileCopies:
                                 changedPaths.append({
                                     "action": "A",
-                                    "path": f,
-                                    "copyfrom": fileCopies[f],
+                                    "path": self.__modifyForLargeFiles(f),
+                                    "copyfrom": self.__modifyForLargeFiles(
+                                        fileCopies[f]),
                                 })
                             else:
                                 changedPaths.append({
                                     "action": "A",
-                                    "path": f,
+                                    "path": self.__modifyForLargeFiles(f),
                                     "copyfrom": "",
                                 })
                 elif key == "files_mods":
@@ -918,7 +937,7 @@
                         for f in value.strip().split(", "):
                             changedPaths.append({
                                 "action": "M",
-                                "path": f,
+                                "path": self.__modifyForLargeFiles(f),
                                 "copyfrom": "",
                             })
                 elif key == "file_dels":
@@ -926,7 +945,7 @@
                         for f in value.strip().split(", "):
                             changedPaths.append({
                                 "action": "D",
-                                "path": f,
+                                "path": self.__modifyForLargeFiles(f),
                                 "copyfrom": "",
                             })
                 elif key == "file_copies":

eric ide

mercurial