Plugins/VcsPlugins/vcsMercurial/HgLogBrowserDialog.py

changeset 3317
d7639a86e90f
parent 3315
bd1a25ead18d
child 3330
955e15f0ecce
equal deleted inserted replaced
3316:aaa864fa5c1e 3317:d7639a86e90f
6 """ 6 """
7 Module implementing a dialog to browse the log history. 7 Module implementing a dialog to browse the log history.
8 """ 8 """
9 9
10 import os 10 import os
11 import re
11 12
12 from PyQt4.QtCore import pyqtSlot, Qt, QDate, QProcess, QTimer, QRegExp, \ 13 from PyQt4.QtCore import pyqtSlot, Qt, QDate, QProcess, QTimer, QRegExp, \
13 QSize, QPoint 14 QSize, QPoint
14 from PyQt4.QtGui import QWidget, QDialogButtonBox, QHeaderView, \ 15 from PyQt4.QtGui import QWidget, QDialogButtonBox, QHeaderView, \
15 QTreeWidgetItem, QApplication, QCursor, QLineEdit, QColor, \ 16 QTreeWidgetItem, QApplication, QCursor, QLineEdit, QColor, \
39 AuthorColumn = 4 40 AuthorColumn = 4
40 DateColumn = 5 41 DateColumn = 5
41 MessageColumn = 6 42 MessageColumn = 6
42 TagsColumn = 7 43 TagsColumn = 7
43 44
45 LargefilesCacheL = ".hglf/"
46 LargefilesCacheW = ".hglf\\"
47 PathSeparatorRe = re.compile(r"/|\\")
48
44 def __init__(self, vcs, mode="log", parent=None): 49 def __init__(self, vcs, mode="log", parent=None):
45 """ 50 """
46 Constructor 51 Constructor
47 52
48 @param vcs reference to the vcs object 53 @param vcs reference to the vcs object
866 self.buttonBox.button(QDialogButtonBox.Close).setDefault(True) 871 self.buttonBox.button(QDialogButtonBox.Close).setDefault(True)
867 872
868 self.inputGroup.setEnabled(False) 873 self.inputGroup.setEnabled(False)
869 self.inputGroup.hide() 874 self.inputGroup.hide()
870 self.refreshButton.setEnabled(True) 875 self.refreshButton.setEnabled(True)
876
877 def __modifyForLargeFiles(self, filename):
878 """
879 Private method to convert the displayed file name for a large file.
880
881 @param filename file name to be processed (string)
882 @return processed file name (string)
883 """
884 if filename.startswith((self.LargefilesCacheL, self.LargefilesCacheW)):
885 return self.tr("{0} (large file)").format(
886 self.PathSeparatorRe.split(filename, 1)[1])
887 else:
888 return filename
871 889
872 def __processBuffer(self): 890 def __processBuffer(self):
873 """ 891 """
874 Private method to process the buffered output of the hg log command. 892 Private method to process the buffered output of the hg log command.
875 """ 893 """
902 if value.strip(): 920 if value.strip():
903 for f in value.strip().split(", "): 921 for f in value.strip().split(", "):
904 if f in fileCopies: 922 if f in fileCopies:
905 changedPaths.append({ 923 changedPaths.append({
906 "action": "A", 924 "action": "A",
907 "path": f, 925 "path": self.__modifyForLargeFiles(f),
908 "copyfrom": fileCopies[f], 926 "copyfrom": self.__modifyForLargeFiles(
927 fileCopies[f]),
909 }) 928 })
910 else: 929 else:
911 changedPaths.append({ 930 changedPaths.append({
912 "action": "A", 931 "action": "A",
913 "path": f, 932 "path": self.__modifyForLargeFiles(f),
914 "copyfrom": "", 933 "copyfrom": "",
915 }) 934 })
916 elif key == "files_mods": 935 elif key == "files_mods":
917 if value.strip(): 936 if value.strip():
918 for f in value.strip().split(", "): 937 for f in value.strip().split(", "):
919 changedPaths.append({ 938 changedPaths.append({
920 "action": "M", 939 "action": "M",
921 "path": f, 940 "path": self.__modifyForLargeFiles(f),
922 "copyfrom": "", 941 "copyfrom": "",
923 }) 942 })
924 elif key == "file_dels": 943 elif key == "file_dels":
925 if value.strip(): 944 if value.strip():
926 for f in value.strip().split(", "): 945 for f in value.strip().split(", "):
927 changedPaths.append({ 946 changedPaths.append({
928 "action": "D", 947 "action": "D",
929 "path": f, 948 "path": self.__modifyForLargeFiles(f),
930 "copyfrom": "", 949 "copyfrom": "",
931 }) 950 })
932 elif key == "file_copies": 951 elif key == "file_copies":
933 if value.strip(): 952 if value.strip():
934 for entry in value.strip().split(", "): 953 for entry in value.strip().split(", "):

eric ide

mercurial