Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 2.1.1, 2.1.2, and tip

stable license: refresh with current address from fsf.org (fixes #858)

Changeset 7e8415d9e124

Parent 9d58ecd48e43

by André Sintzoff

Changes to 13 files · Browse files at 7e8415d9e124 Showing diff from parent 9d58ecd48e43 Diff from another changeset...

 
12
13
14
15
 
16
17
18
 
12
13
14
 
15
16
17
18
@@ -12,7 +12,7 @@
 #  # You should have received a copy of the GNU General Public License along with  # this program; if not, write to the Free Software Foundation, Inc., -# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.    """  Qt4 widgets to display diffs as blocks
 
12
13
14
15
 
16
17
18
 
12
13
14
 
15
16
17
18
@@ -12,7 +12,7 @@
 #  # You should have received a copy of the GNU General Public License along with  # this program; if not, write to the Free Software Foundation, Inc., -# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.  """  Qt4 dialogs to display hg revisions of a file  """
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
 
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
1
2
3
4
5
6
7
8
9
10
11
12
13
14
 
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
 # Copyright (c) 2009-2010 LOGILAB S.A. (Paris, FRANCE).  # http://www.logilab.fr/ -- mailto:contact@logilab.fr  #  # This program is free software; you can redistribute it and/or modify it under  # the terms of the GNU General Public License as published by the Free Software  # Foundation; either version 2 of the License, or (at your option) any later  # version.  #  # This program is distributed in the hope that it will be useful, but WITHOUT  # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS  # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.  #  # You should have received a copy of the GNU General Public License along with  # this program; if not, write to the Free Software Foundation, Inc., -# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.    from tortoisehg.util import hglib, patchctx    from tortoisehg.hgqt.qtlib import geticon, getoverlaidicon    from PyQt4.QtCore import *  from PyQt4.QtGui import *    nullvariant = QVariant()    def getSubrepoIcoDict():   'Return a dictionary mapping each subrepo type to the corresponding icon'   _subrepoType2IcoMap = {   'hg': 'hg',   'git': 'thg-git-subrepo',   'svn': 'thg-svn-subrepo',   'hgsubversion': 'thg-svn-subrepo',   'empty': 'hg'   }   icOverlay = geticon('thg-subrepo')   subrepoIcoDict = {}   for stype in _subrepoType2IcoMap:   ic = geticon(_subrepoType2IcoMap[stype])   ic = getoverlaidicon(ic, icOverlay)   subrepoIcoDict[stype] = ic   return subrepoIcoDict    class HgFileListModel(QAbstractTableModel):   """   Model used for listing (modified) files of a given Hg revision   """   showMessage = pyqtSignal(QString)     def __init__(self, parent):   QAbstractTableModel.__init__(self, parent)   self._boldfont = parent.font()   self._boldfont.setBold(True)   self._ctx = None   self._files = []   self._filesdict = {}   self._fulllist = False   self._subrepoIcoDict = getSubrepoIcoDict()     @pyqtSlot(bool)   def toggleFullFileList(self, value):   self._fulllist = value   self.loadFiles()   self.layoutChanged.emit()     def __len__(self):   return len(self._files)     def rowCount(self, parent=None):   return len(self)     def columnCount(self, parent=None):   return 1     def file(self, row):   return self._files[row]['path']     def setContext(self, ctx):   reload = False   if not self._ctx:   reload = True   elif self._ctx.rev() is None:   reload = True   elif ctx.thgid() != self._ctx.thgid():   reload = True   if reload:   self._ctx = ctx   self.loadFiles()   self.layoutChanged.emit()     def fileFromIndex(self, index):   if not index.isValid() or index.row()>=len(self) or not self._ctx:   return None   row = index.row()   return self._files[row]['path']     def dataFromIndex(self, index):   if not index.isValid() or index.row()>=len(self) or not self._ctx:   return None   row = index.row()   return self._files[row]     def indexFromFile(self, filename):   if filename in self._filesdict:   row = self._files.index(self._filesdict[filename])   return self.index(row, 0)   return QModelIndex()     def _buildDesc(self, parent):   files = []   ctxfiles = self._ctx.files()   modified, added, removed = self._ctx.changesToParent(parent)   ismerge = bool(self._ctx.p2())     # Add the list of modified subrepos to the top of the list   if not isinstance(self._ctx, patchctx.patchctx):   if ".hgsubstate" in ctxfiles or ".hgsub" in ctxfiles:   from mercurial import subrepo   # Add the list of modified subrepos   for s, sd in self._ctx.substate.items():   srev = self._ctx.substate.get(s, subrepo.nullstate)[1]   stype = self._ctx.substate.get(s, subrepo.nullstate)[2]   sp1rev = self._ctx.p1().substate.get(s, subrepo.nullstate)[1]   sp2rev = ''   if ismerge:   sp2rev = self._ctx.p2().substate.get(s, subrepo.nullstate)[1]   if srev != sp1rev or (sp2rev != '' and srev != sp2rev):   wasmerged = ismerge and s in ctxfiles   files.append({'path': s, 'status': 'S', 'parent': parent,   'wasmerged': wasmerged, 'stype': stype})   # Add the list of missing subrepos   subreposet = set(self._ctx.substate.keys())   subrepoparent1set = set(self._ctx.p1().substate.keys())   missingsubreposet = subrepoparent1set.difference(subreposet)   for s in missingsubreposet:   wasmerged = ismerge and s in ctxfiles   stype = self._ctx.p1().substate.get(s, subrepo.nullstate)[2]   files.append({'path': s, 'status': 'S', 'parent': parent,   'wasmerged': wasmerged, 'stype': stype})     if self._fulllist and ismerge:   func = lambda x: True   else:   func = lambda x: x in ctxfiles   for lst, flag in ((added, 'A'), (modified, 'M'), (removed, 'R')):   for f in filter(func, lst):   wasmerged = ismerge and f in ctxfiles   files.append({'path': f, 'status': flag, 'parent': parent,   'wasmerged': wasmerged})   return files     def loadFiles(self):   self._files = []   try:   self._files = self._buildDesc(0)   if bool(self._ctx.p2()):   _paths = [x['path'] for x in self._files]   _files = self._buildDesc(1)   self._files += [x for x in _files if x['path'] not in _paths]   except EnvironmentError, e:   self.showMessage.emit(hglib.tounicode(str(e)))   self._filesdict = dict([(f['path'], f) for f in self._files])     def data(self, index, role):   if not index.isValid() or index.row()>len(self) or not self._ctx:   return nullvariant   if index.column() != 0:   return nullvariant     row = index.row()   column = index.column()     current_file_desc = self._files[row]   current_file = current_file_desc['path']     if role in (Qt.DisplayRole, Qt.ToolTipRole):   return QVariant(hglib.tounicode(current_file))   elif role == Qt.DecorationRole:   if self._fulllist and bool(self._ctx.p2()):   if current_file_desc['wasmerged']:   icn = geticon('thg-file-merged')   elif current_file_desc['parent'] == 0:   icn = geticon('thg-file-p0')   elif current_file_desc['parent'] == 1:   icn = geticon('thg-file-p1')   return QVariant(icn.pixmap(20,20))   elif current_file_desc['status'] == 'A':   return QVariant(geticon('fileadd'))   elif current_file_desc['status'] == 'R':   return QVariant(geticon('filedelete'))   elif current_file_desc['status'] == 'S':   stype = current_file_desc.get('stype', 'hg')   return QVariant(self._subrepoIcoDict[stype])   #else:   # return QVariant(geticon('filemodify'))   elif role == Qt.FontRole:   if current_file_desc['wasmerged']:   return QVariant(self._boldfont)   else:   return nullvariant
 
12
13
14
15
 
16
17
18
 
12
13
14
 
15
16
17
18
@@ -12,7 +12,7 @@
 #  # You should have received a copy of the GNU General Public License along with  # this program; if not, write to the Free Software Foundation, Inc., -# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.    import os  
 
12
13
14
15
 
16
17
18
 
12
13
14
 
15
16
17
18
@@ -12,7 +12,7 @@
 #  # You should have received a copy of the GNU General Public License along with  # this program; if not, write to the Free Software Foundation, Inc., -# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.    from tortoisehg.hgqt.repomodel import HgRepoListModel, COLUMNHEADERS  from tortoisehg.hgqt.graph import Graph, filelog_grapher
 
12
13
14
15
 
16
17
18
 
12
13
14
 
15
16
17
18
@@ -12,7 +12,7 @@
 #  # You should have received a copy of the GNU General Public License along with  # this program; if not, write to the Free Software Foundation, Inc., -# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.    """helper functions and classes to ease hg revision graph building  
 
12
13
14
15
 
16
17
18
 
12
13
14
 
15
16
17
18
@@ -12,7 +12,7 @@
 #  # You should have received a copy of the GNU General Public License along with  # this program; if not, write to the Free Software Foundation, Inc., -# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.  """  Qt4 QToolBar-based class for quick bars XXX  """
 
12
13
14
15
 
16
17
18
 
12
13
14
 
15
16
17
18
@@ -12,7 +12,7 @@
 #  # You should have received a copy of the GNU General Public License along with  # this program; if not, write to the Free Software Foundation, Inc., -# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.    from mercurial import util, error  from mercurial.util import propertycache
 
12
13
14
15
 
16
17
18
 
12
13
14
 
15
16
17
18
@@ -12,7 +12,7 @@
 #  # You should have received a copy of the GNU General Public License along with  # this program; if not, write to the Free Software Foundation, Inc., -# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.    from mercurial import error  
 
12
13
14
15
 
16
17
18
 
12
13
14
 
15
16
17
18
@@ -12,7 +12,7 @@
 #  # You should have received a copy of the GNU General Public License  # along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA    import gtk  from tortoisehg.util.i18n import _
 
12
13
14
15
 
16
17
18
 
94
95
96
97
 
98
99
100
 
12
13
14
 
15
16
17
18
 
94
95
96
 
97
98
99
100
@@ -12,7 +12,7 @@
   # You should have received a copy of the GNU General Public License  # along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA  import sys, math    def _days(ctx, now): @@ -94,7 +94,7 @@
    def saturate_v(self, saturation, hv):   return int(255 - (saturation/3*(1-hv))) - +   def committer_angle(self, committer):   angle = float(abs(hash(committer))) / sys.maxint * 360.0   if self._maxhues is None:
 
13
14
15
16
 
17
18
19
 
36
37
38
39
 
40
41
42
 
49
50
51
52
 
53
54
55
56
 
57
58
59
 
13
14
15
 
16
17
18
19
 
36
37
38
 
39
40
41
42
 
49
50
51
 
52
53
54
55
 
56
57
58
59
@@ -13,7 +13,7 @@
   // You should have received a copy of the GNU General Public License  // along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.    #include "StringUtils.h"   @@ -36,7 +36,7 @@
  CodePage, 0, wide.c_str(), static_cast<int>(wide.length()),   NULL, 0, NULL, NULL   ); - +   std::vector<CHAR> narrow(ret + 1);     ret = WideCharToMultiByte( @@ -49,11 +49,11 @@
 }     -// Convert multibyte string to Unicode string +// Convert multibyte string to Unicode string  std::wstring MultibyteToWide(const std::string& multibyte, UINT CodePage)  {   int ret = MultiByteToWideChar( - CodePage, 0, multibyte.c_str(), + CodePage, 0, multibyte.c_str(),   static_cast<int>(multibyte.length()), 0, 0   );  
 
13
14
15
16
 
17
18
19
 
27
28
29
30
 
31
32
33
 
13
14
15
 
16
17
18
19
 
27
28
29
 
30
31
32
33
@@ -13,7 +13,7 @@
   // You should have received a copy of the GNU General Public License  // along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.    #ifndef _STRING_UTILS_H  #define _STRING_UTILS_H @@ -27,7 +27,7 @@
 // Convert Unicode string to multibyte string  std::string WideToMultibyte(const std::wstring& wide, UINT CodePage = CP_ACP);   -// Convert multibyte string to Unicode string +// Convert multibyte string to Unicode string  std::wstring MultibyteToWide(const std::string& multibyte, UINT CodePage = CP_ACP);