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

fogcreek Merge with stable

Changeset 3dd57d56e9c5

Parents 15c620efc0e9

Parents d78d17ef5fdd

by David Golub

Changes to 40 files · Browse files at 3dd57d56e9c5 Showing diff from parent 15c620efc0e9 d78d17ef5fdd Diff from another changeset...

Change 1 of 1 Show Entire File .hgtags Stacked
 
58
59
60
 
 
58
59
60
61
@@ -58,3 +58,4 @@
 f2165388e6870c643636a0a74f1ebd1d008bdf3e 2.0.5  2a970d5e40fe4f757347464d820218809d58251b 2.1  65a385cf4238af969487dc1a7a2b5ee60cf388cc 2.1.1 +d9e84b581ef3961a12fe695a566ffafb9944920e 2.1.2
 
402
403
404
405
406
 
407
408
409
 
402
403
404
 
 
405
406
407
408
@@ -402,8 +402,7 @@
  self.fullmsg.split('\0', 6)   text = hglib.tounicode(text)   text = Qt.escape(text) - text = '<b>%s</b> <span>%s</span>' % ( - addremove, text[:-1]) + text = '<b>%s</b> <span>%s</span>' % (addremove, text)   row = [fname, rev, line, user, text]   emitrow(row)   except ValueError:
 
541
542
543
544
 
 
545
546
547
 
541
542
543
 
544
545
546
547
548
@@ -541,7 +541,8 @@
  dlg.setSearchPattern(opts['pattern'])   if dlg._manifest_widget._fileview.actionAnnMode.isEnabled():   dlg._manifest_widget._fileview.actionAnnMode.trigger() - dlg.setSearchCaseInsensitive(opts['ignorecase']) + if 'ignorecase' in opts: + dlg.setSearchCaseInsensitive(opts['ignorecase'])   except IndexError:   pass   dlg.setSearchPattern(hglib.tounicode(opts.get('pattern')) or '')
 
279
280
281
282
 
 
 
283
284
285
 
279
280
281
 
282
283
284
285
286
287
@@ -279,7 +279,9 @@
  else:   idx = self.model().indexFromRev(rev)   if idx is not None: - self.setCurrentIndex(idx) + # avoid unwanted selection change (#1019) + if self.currentIndex().row() != idx.row(): + self.setCurrentIndex(idx)   self.scrollTo(idx)     def saveSettings(self, s = None):
 
1437
1438
1439
1440
 
1441
1442
1443
 
1485
1486
1487
1488
1489
 
 
1490
1491
1492
1493
1494
1495
1496
1497
 
 
1498
1499
1500
 
1437
1438
1439
 
1440
1441
1442
1443
 
1485
1486
1487
 
 
1488
1489
1490
1491
1492
1493
1494
1495
 
 
1496
1497
1498
1499
1500
@@ -1437,7 +1437,7 @@
  QMessageBox.warning(self,   _('Cannot export revision'),   (_('Cannot export revision %s into the file named:' - '\n\n%s\n') % (rev, epath % rev)) + \ + '\n\n%s\n') % (rev, hglib.tounicode(epath % rev))) + \   _('There is already an existing folder '   'with that same name.'))   return @@ -1485,16 +1485,16 @@
  '<a href="file:///%s">%s</a>%s'   '<a href="file:///%s">%s</a>') \   % (rev, str(self.repo[rev]), - patchdirname, patchdirname, os.path.sep, - patchfilename, patchshortname)) + hglib.tounicode(patchdirname), hglib.tounicode(patchdirname), os.path.sep, + hglib.tounicode(patchfilename), hglib.tounicode(patchshortname)))   else:   # Show a message box with a link to the export folder   qtlib.InfoMsgBox(_('Patches exported'),   _('%d patches were exported to:<p>'   '<a href="file:///%s">%s</a>') \   % (len(revisions), - strdir, - strdir)) + hglib.tounicode(strdir), + hglib.tounicode(strdir)))     def visualDiffRevision(self):   opts = dict(change=self.rev)
 
336
337
338
339
 
 
340
341
342
 
871
872
873
874
 
875
876
877
 
336
337
338
 
339
340
341
342
343
 
872
873
874
 
875
876
877
878
@@ -336,7 +336,8 @@
  if status in 'MAR!':   self.actions.allactions[0].trigger()   elif status == 'S': - self.linkActivated.emit(u'subrepo:'+hglib.tounicode(path)) + self.linkActivated.emit( + u'subrepo:' + hglib.tounicode(self.repo.wjoin(path)))     @pyqtSlot(QString)   def setFilter(self, match): @@ -871,7 +872,7 @@
  assert util.all(c in self._TYPES for c in text)   for c in self._TYPES:   self._actions[c].setChecked(c in text) - +  class StatusDialog(QDialog):   'Standalone status browser'   def __init__(self, repo, pats, opts, parent=None):
 
88
89
90
91
 
92
93
94
 
112
113
114
115
116
117
 
 
118
119
120
 
121
122
123
 
88
89
90
 
91
92
93
94
 
112
113
114
 
 
 
115
116
117
118
 
119
120
121
122
@@ -88,7 +88,7 @@
  dbgoutput('not watching F/S events for network drive')   else:   self.watcher = QFileSystemWatcher(self) - self.watcher.addPath(repo.path) + self.watcher.addPath(hglib.tounicode(repo.path))   self.watcher.directoryChanged.connect(self.onDirChange)   self.watcher.fileChanged.connect(self.onFileChange)   self.addMissingPaths() @@ -112,12 +112,11 @@
  for f in existing:   if hglib.tounicode(f) not in files:   dbgoutput('add file to watcher:', f) - self.watcher.addPath(f) - _, files = self.repo.uifiles() - for f in files: + self.watcher.addPath(hglib.tounicode(f)) + for f in self.repo.uifiles()[1]:   if f and os.path.exists(f) and hglib.tounicode(f) not in files:   dbgoutput('add ui file to watcher:', f) - self.watcher.addPath(f) + self.watcher.addPath(hglib.tounicode(f))     def pollStatus(self):   if not os.path.exists(self.repo.path):
Change 1 of 1 Show Entire File win32/​shellext/​Directory.cpp Stacked
 
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
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
@@ -1,242 +0,0 @@
-// Copyright (C) 2011 Fog Creek Software -// Copyright (C) 2009 Benjamin Pollack -// Copyright (C) 2009 Adrian Buehlmann -// -// 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, see <http://www.gnu.org/licenses/>. - -#include "stdafx.h" - -#include "Directory.h" -#include "Winstat.h" - -#include <time.h> - -CDirectory::CDirectory(CDirectory* pParent, const CString& strName, - const CString& strBasePath) : - m_pParent(pParent), m_strName(strName) -{ - if (strName.IsEmpty()) - { - m_strPath = strBasePath; - } - else if (strBasePath.IsEmpty()) - { - m_strPath = strName; - } - else - { - m_strPath = strBasePath + '/' + strName; - } -} - -CDirectory::~CDirectory() -{ - POSITION position = m_listSubdirs.GetHeadPosition(); - while (position != NULL) - { - delete m_listSubdirs.GetNext(position); - } -} - -int SplitBase(const CString& strPath, CString& strBase, CString& strRest) -{ - if (strPath.IsEmpty()) return 0; - - int nPos = strPath.Find('/'); - if (nPos == -1) - { - strBase.Empty(); - strRest = strPath; - return 1; - } - - if (nPos == 0 || nPos == strPath.GetLength() - 1) return 0; - - strBase = strPath.Left(nPos); - strRest = strPath.Mid(nPos + 1); - - return 1; -} - -int CDirectory::Add(CString strName, CDirentry& rEntry) -{ - CString strBase; - CString strRest; - - CDirectory* cur = this; - - for (;;) - { - - if (!SplitBase(strName, strBase, strRest)) - { - ATLTRACE("CDirectory('%s')::Add(%d): splitbase returned 0\n", - (LPCTSTR)Path(), (LPCTSTR)strName); - return 0; - } - - if (strBase.IsEmpty()) - { - rEntry.m_strName = strName; - cur->m_listFiles.AddTail(rEntry); - return 1; - } - - CDirectory* pDir = 0; - POSITION position = cur->m_listSubdirs.GetHeadPosition(); - while (position != NULL) - { - CDirectory* pItem = cur->m_listSubdirs.GetNext(position); - if (pItem->m_strName == strBase) - { - pDir = pItem; - break; - } - } - - if (!pDir) - { - pDir = new CDirectory(cur, strBase, cur->Path()); - cur->m_listSubdirs.AddTail(pDir); - } - - strName = strRest; - cur = pDir; - } -} - -const CDirentry* CDirectory::Get(CString strRelPath) const -{ - CString strBase; - CString strRest; - - const CDirectory* pCur = this; - - for (;;) - { - loopstart: - - if (!SplitBase(strRelPath, strBase, strRest)) - { - ATLTRACE("CDirectory('%s')::Get(%d): splitbase returned 0\n", - (LPCTSTR)Path(), (LPCTSTR)strRelPath); - return 0; - } - - if (strBase.IsEmpty()) - { - POSITION position = pCur->m_listFiles.GetHeadPosition(); - while (position != NULL) - { - const CDirentry& rItem = pCur->m_listFiles.GetNext(position); - if (rItem.m_strName == strRelPath) return &rItem; - } - return 0; - } - - POSITION position = pCur->m_listSubdirs.GetHeadPosition(); - while (position != NULL) - { - CDirectory* pItem = pCur->m_listSubdirs.GetNext(position); - if (pItem->m_strName == strBase) - { - pCur = pItem; - strRelPath = strRest; - goto loopstart; - } - } - - return 0; - } -} - -CDirectory* CDirectory::GetDir(CString strRelPath) -{ - CString strBase; - CString strRest; - - const CDirectory* pCur = this; - - for (;;) - { - loopstart: - - if (!SplitBase(strRelPath, strBase, strRest)) - { - ATLTRACE("Directory('%s')::getdir('%s'): splitbase returned 0\n", - (LPCTSTR)Path(), (LPCTSTR)strRelPath); - return 0; - } - - bool bLeaf = strBase.IsEmpty(); - const CString& strSearch = (bLeaf ? strRelPath : strBase); - - POSITION position = pCur->m_listSubdirs.GetHeadPosition(); - while (position != NULL) - { - CDirectory* pItem = pCur->m_listSubdirs.GetNext(position); - if (pItem->m_strName == strSearch) - { - if (bLeaf) return pItem; - pCur = pItem; - strRelPath = strRest; - goto loopstart; - } - } - - return 0; - } -} - -void CDirectory::Print() const -{ - POSITION position = m_listSubdirs.GetHeadPosition(); - while (position != NULL) - { - const CDirectory* pDir = m_listSubdirs.GetNext(position); - if (!pDir) - { - ATLTRACE("Directory('%s')::print: error: d is 0\n", (LPCTSTR)Path()); - return; - } - pDir->Print(); - } - - CString strBase = Path(); - - time_t t; - CString str; - char ctime_res[26]; - - position = m_listFiles.GetHeadPosition(); - while (position != NULL) - { - const CDirentry& rItem = m_listFiles.GetNext(position); - CString strPath = (!strBase.IsEmpty() ? strBase + "/" + rItem.m_strName : - rItem.m_strName); - t = rItem.m_uMTime; - errno_t err = ctime_s(ctime_res, 26, &t); - if (err == 0) - { - str = ctime_res; - str.Truncate(str.GetLength() - 1); // strip ending '\n' - } - else - { - str = "unset"; - } - printf("%c %6o %10u %-24s %s\n", rItem.m_chState, rItem.m_uMode, rItem.m_uSize, - (LPCTSTR)str, (LPCTSTR)strPath); - } -}
Change 1 of 1 Show Entire File win32/​shellext/​Directory.h Stacked
 
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
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
@@ -1,42 +0,0 @@
-// Copyright (C) 2011 Fog Creek Software -// Copyright (C) 2009 Benjamin Pollack -// Copyright (C) 2009 Adrian Buehlmann -// -// 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, see <http://www.gnu.org/licenses/>. - -#pragma once -#include "Direntry.h" - -class CDirectory -{ - const CDirectory* m_pParent; - CString m_strName; - CString m_strPath; - - CAtlList<CDirectory*> m_listSubdirs; - CAtlList<CDirentry> m_listFiles; - -public: - CDirectory(CDirectory* pParent, const CString& strName, const CString& strBasePath); - ~CDirectory(); - - const CString& Path() const { return m_strPath; } - - int Add(CString strRelPath, CDirentry& rEntry); - - const CDirentry* Get(CString strRelPath) const; - CDirectory* GetDir(CString strRelPath); - - void Print() const; -};
Change 1 of 1 Show Entire File win32/​shellext/​DirectoryStatus.cpp Stacked
 
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
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
@@ -1,150 +0,0 @@
-// Copyright (C) 2011 Fog Creek Software -// Copyright (C) 2009 Adrian Buehlmann -// -// 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, see <http://www.gnu.org/licenses/>. - -#include "stdafx.h" - -#include "DirectoryStatus.h" -#include "THgStatus.h" -#include "TortoiseUtils.h" - -char CDirectoryStatus::Status(CString strRelPath) const -{ - bool bAdded = false; - bool bModified = false; - - strRelPath += '/'; - - POSITION position = m_listEntries.GetHeadPosition(); - while (position != NULL) - { - const CEntry& rEntry = m_listEntries.GetNext(position); - if (strRelPath.IsEmpty() || rEntry.strPath.Left(strRelPath.GetLength()) == strRelPath) - { - if (rEntry.chStatus == 'm' || rEntry.chStatus == 'r') - { - bModified = true; - break; - } - if (rEntry.chStatus == 'a') - { - bAdded = true; - } - } - } - - if (bModified) return 'M'; - if (bAdded) return 'A'; - return 'C'; -} - -int CDirectoryStatus::Read(const CString& strHgRoot, const CString& strCwd) -{ - m_listEntries.RemoveAll(); - m_bNoIcons = false; - - CString strStatusPath = strHgRoot + "\\.hg\\thgstatus"; - - CAtlFile file; - if (FAILED(file.Create(strStatusPath, GENERIC_READ, - FILE_SHARE_DELETE | FILE_SHARE_READ | FILE_SHARE_WRITE, OPEN_EXISTING))) - { - ATLTRACE("CDirectoryStatus::read: can't open '%s'\n", (LPCTSTR)strStatusPath); - CString p = (strCwd.GetLength() < strHgRoot.GetLength() ? strHgRoot : strCwd); - CTHgStatus::Update(strStatusPath); - return 0; - } - - CDirectoryStatus::CEntry e; - - int nRes = 1; - const CString strNoIcons = "@@noicons"; - - CString strLine; - - for (;;) - { - strLine.Empty(); - char chStatus; - - for (;;) - { - if (FAILED(file.Read(&chStatus, sizeof(char)))) goto close; - if (chStatus == '\n') break; - strLine.AppendChar(chStatus); - if (strLine.GetLength() > 1000) - { - nRes = 0; - goto close; - } - } - - if (StartsWith(strLine, strNoIcons)) - { - m_bNoIcons = true; - goto close; - } - - if (strLine.IsEmpty()) goto close; - e.chStatus = strLine[0]; - - CString strPath; - if (strLine.GetLength() > 1) - { - strPath = strLine.Mid(1).MakeLower(); - } - strPath.AppendChar('/'); - - e.strPath = strPath; - - m_listEntries.AddTail(e); - } - -close: - file.Close(); - - ATLTRACE("DirectoryStatus::read(%d): done. %d entries read. noicons_ = %d\n", - m_listEntries.GetCount(), m_bNoIcons); - - return nRes; -} - -struct CCacheEntry -{ - CString strHgRoot; - CDirectoryStatus ds; - bool bReadFailed; - unsigned uTickCount; - - CCacheEntry() : bReadFailed(false), uTickCount(0) {} -}; - -CDirectoryStatus* CDirectoryStatus::Get(const CString& strHgRoot, - const CString& strCwd) -{ - static CCacheEntry ce; - - unsigned tc = ::GetTickCount(); - - if (ce.strHgRoot != strHgRoot || (tc - ce.uTickCount) > 2000) - { - ce.strHgRoot.Empty(); - ce.bReadFailed = (ce.ds.Read(strHgRoot, strCwd) == 0); - ce.strHgRoot = strHgRoot; - ce.uTickCount = ::GetTickCount(); - } - - return (ce.bReadFailed ? 0 : &ce.ds); -}
Change 1 of 1 Show Entire File win32/​shellext/​DirectoryStatus.h Stacked
 
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
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
@@ -1,41 +0,0 @@
-// Copyright (C) 2011 Fog Creek Software -// Copyright (C) 2009 Adrian Buehlmann -// -// 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, see <http://www.gnu.org/licenses/>. - -#pragma once - -class CDirectoryStatus -{ - struct CEntry - { - CString strPath; - char chStatus; - - CEntry() : chStatus(0) {} - }; - - CAtlList<CEntry> m_listEntries; - bool m_bNoIcons; - -public: - CDirectoryStatus() : m_bNoIcons(false) {} - - static CDirectoryStatus* Get(const CString& strHgRoot, const CString& strCwd); - char Status(CString strRelPath) const; - bool NoIcons() const { return m_bNoIcons; } - -private: - int Read(const CString& strHgRoot, const CString& strCwd); -};
Change 1 of 1 Show Entire File win32/​shellext/​Direntry.cpp Stacked
 
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
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
@@ -1,67 +0,0 @@
-// Copyright (C) 2011 Fog Creek Software -// Copyright (C) 2009 Benjamin Pollack -// Copyright (C) 2009 Adrian Buehlmann -// -// 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, see <http://www.gnu.org/licenses/>. - -#include "stdafx.h" - -#include "Direntry.h" -#include "Winstat.h" - -bool CDirentry::Read(CAtlFile& rFile, CString& strRelPath) -{ - if (FAILED(rFile.Read(&m_chState, sizeof(char)))) return false; - - unsigned nLength = 0; - - rFile.Read(&m_uMode, sizeof(unsigned)); - rFile.Read(&m_uSize, sizeof(unsigned)); - rFile.Read(&m_uMTime, sizeof(unsigned)); - rFile.Read(&nLength, sizeof(unsigned)); - - m_uMode = ntohl(m_uMode); - m_uSize = ntohl(m_uSize); - m_uMTime = ntohl(m_uMTime); - nLength = ntohl(nLength); - - LPSTR lpszBuf = strRelPath.GetBuffer(nLength); - rFile.Read(lpszBuf, nLength * sizeof(char)); - strRelPath.ReleaseBuffer(nLength); - - strRelPath = strRelPath.MakeLower(); - - return true; -} - -char CDirentry::Status(const CWinstat& stat) const -{ - switch (m_chState) - { - case 'n': - if (m_uSize != (unsigned)stat.ullSize) - return 'M'; // modified - if (m_uMTime == (unsigned)stat.ullMTime) - return 'C'; // clean - return 'P'; // must peek into file contents - case 'm': - return 'M'; - case 'r': - return 'R'; - case 'a': - return 'A'; - default: - return '?'; - } -}
Change 1 of 1 Show Entire File win32/​shellext/​Direntry.h Stacked
 
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
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
@@ -1,51 +0,0 @@
-// Copyright (C) 2011 Fog Creek Software -// Copyright (C) 2009 Benjamin Pollack -// Copyright (C) 2009 Adrian Buehlmann -// -// 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, see <http://www.gnu.org/licenses/>. - -#pragma once -#include <stdint.h> - -class CWinstat; - -class CDirentry -{ -public: - unsigned char m_chState; - unsigned m_uMode; - unsigned m_uSize; - unsigned m_uMTime; - - CString m_strName; - - bool Read(CAtlFile& rFile, CString& strRelPath); - char Status(const CWinstat& stat) const; - - bool Unset() const - { - return (m_chState == 'n') && (m_uMode == 0) && (m_uSize == -1) && - (m_uMTime == -1); - } - -private: - static uint32_t ntohl(uint32_t x) - { - return ((x & 0x000000ffUL) << 24) | - ((x & 0x0000ff00UL) << 8) | - ((x & 0x00ff0000UL) >> 8) | - ((x & 0xff000000UL) >> 24); - } -}; -
Change 1 of 1 Show Entire File win32/​shellext/​IconBitmapUtils.cpp Stacked
 
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
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
@@ -1,287 +0,0 @@
-// Copyright (C) 2011 Fog Creek Software -// Copyright (C) 2009 TortoiseSVN -// -// 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, -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - -// Adapted for use in TortoiseHg by Veniamin Albaev - -#include "stdafx.h" - -#include "IconBitmapUtils.h" -#include "SysInfo.h" - -CIconBitmapUtils::CIconBitmapUtils() : - m_hUxTheme(NULL) -{ - if (CSysInfo::IsVistaOrLater()) - { - m_hUxTheme = ::LoadLibrary(_T("UXTHEME.DLL")); - - if (m_hUxTheme) - { - m_pfnGetBufferedPaintBits = (FN_GetBufferedPaintBits)::GetProcAddress( - m_hUxTheme, "GetBufferedPaintBits"); - m_pfnBeginBufferedPaint = (FN_BeginBufferedPaint)::GetProcAddress(m_hUxTheme, - "BeginBufferedPaint"); - m_pfnEndBufferedPaint = (FN_EndBufferedPaint)::GetProcAddress(m_hUxTheme, - "EndBufferedPaint"); - } - } -} - -CIconBitmapUtils::~CIconBitmapUtils() -{ - if (m_hUxTheme) - ::FreeLibrary(m_hUxTheme); -} - -HBITMAP CIconBitmapUtils::IconToBitmap(HICON hIcon) -{ - if (!hIcon) return NULL; - - RECT rect; - - rect.right = ::GetSystemMetrics(SM_CXMENUCHECK); - rect.bottom = ::GetSystemMetrics(SM_CYMENUCHECK); - - rect.left = rect.top = 0; - - HWND hwndDesktop = ::GetDesktopWindow(); - if (hwndDesktop == NULL) return NULL; - - HDC hScreenDC = ::GetDC(hwndDesktop); - if (hScreenDC == NULL) return NULL; - - // Create a compatible DC - HDC hDestDC = ::CreateCompatibleDC(hScreenDC); - if (hDestDC == NULL) - { - ::ReleaseDC(hwndDesktop, hScreenDC); - return NULL; - } - - // Create a new bitmap of icon size - HBITMAP hBitmap = ::CreateCompatibleBitmap(hScreenDC, rect.right, rect.bottom); - if (hBitmap == NULL) - { - ::DeleteDC(hDestDC); - ::ReleaseDC(hwndDesktop, hScreenDC); - return NULL; - } - - // Select it into the compatible DC - HBITMAP hOldBitmap = (HBITMAP)::SelectObject(hDestDC, hBitmap); - if (hOldBitmap == NULL) return NULL; - - // Fill the background of the compatible DC with the white color - // that is taken by menu routines as transparent - ::SetBkColor(hDestDC, RGB(255, 255, 255)); - ::ExtTextOut(hDestDC, 0, 0, ETO_OPAQUE, &rect, NULL, 0, NULL); - - // Draw the icon into the compatible DC - ::DrawIconEx(hDestDC, 0, 0, hIcon, rect.right, rect.bottom, 0, NULL, DI_NORMAL); - - // Restore settings - ::SelectObject(hDestDC, hOldBitmap); - ::DeleteDC(hDestDC); - ::ReleaseDC(hwndDesktop, hScreenDC); - - return hBitmap; -} - -HBITMAP CIconBitmapUtils::IconToBitmapPARGB32(HICON hIcon) -{ - if (!hIcon) return NULL; - - if (m_pfnBeginBufferedPaint == NULL || m_pfnEndBufferedPaint == NULL || - m_pfnGetBufferedPaintBits == NULL) - { - ATLTRACE(" CIconBitmapUtils::IconToBitmapPARGB32: Theme functions not found, " - "returns NULL\n"); - return NULL; - } - - SIZE sizeIcon; - sizeIcon.cx = ::GetSystemMetrics(SM_CXSMICON); - sizeIcon.cy = ::GetSystemMetrics(SM_CYSMICON); - - RECT rcIcon; - ::SetRect(&rcIcon, 0, 0, sizeIcon.cx, sizeIcon.cy); - HBITMAP hBitmap = NULL; - - HDC hDestDC = ::CreateCompatibleDC(NULL); - if (hDestDC) - { - if (SUCCEEDED(Create32BitHBITMAP(hDestDC, &sizeIcon, NULL, &hBitmap))) - { - HBITMAP hOldBitmap = (HBITMAP)::SelectObject(hDestDC, hBitmap); - if (hOldBitmap) - { - BLENDFUNCTION bfAlpha = { AC_SRC_OVER, 0, 255, AC_SRC_ALPHA }; - BP_PAINTPARAMS paintParams = {0}; - paintParams.cbSize = sizeof(BP_PAINTPARAMS); - paintParams.dwFlags = BPPF_ERASE; - paintParams.pBlendFunction = &bfAlpha; - - HDC hBufferDC; - HPAINTBUFFER hPaintBuffer = m_pfnBeginBufferedPaint(hDestDC, &rcIcon, - BPBF_DIB, &paintParams, &hBufferDC); - if (hPaintBuffer) - { - if (::DrawIconEx(hBufferDC, 0, 0, hIcon, sizeIcon.cx, sizeIcon.cy, 0, - NULL, DI_NORMAL)) - { - // If icon did not have an alpha channel we need to convert buffer to PARGB - ConvertBufferToPARGB32(hPaintBuffer, hDestDC, hIcon, sizeIcon); - } - // This will write the buffer contents to the destination bitmap - m_pfnEndBufferedPaint(hPaintBuffer, TRUE); - } - - ::SelectObject(hDestDC, hOldBitmap); - } - } - - ::DeleteDC(hDestDC); - } - - return hBitmap; -} - -HRESULT CIconBitmapUtils::Create32BitHBITMAP(HDC hDC, const SIZE *pSize, void **ppvBits, - HBITMAP* phBitmap) -{ - *phBitmap = NULL; - - BITMAPINFO bmi; - ::SecureZeroMemory(&bmi, sizeof(BITMAPINFO)); - bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); - bmi.bmiHeader.biPlanes = 1; - bmi.bmiHeader.biCompression = BI_RGB; - - bmi.bmiHeader.biWidth = pSize->cx; - bmi.bmiHeader.biHeight = pSize->cy; - bmi.bmiHeader.biBitCount = 32; - - HDC hUsedDC = hDC ? hDC : ::GetDC(NULL); - if (hUsedDC) - { - *phBitmap = ::CreateDIBSection(hUsedDC, &bmi, DIB_RGB_COLORS, ppvBits, NULL, 0); - if (hDC != hUsedDC) - { - ::ReleaseDC(NULL, hUsedDC); - } - } - return (NULL == *phBitmap) ? E_OUTOFMEMORY : S_OK; -} - -HRESULT CIconBitmapUtils::ConvertBufferToPARGB32(HPAINTBUFFER hPaintBuffer, HDC hDC, - HICON hIcon, SIZE& sizeIcon) -{ - RGBQUAD *prgbQuad; - int cxRow; - HRESULT hr = m_pfnGetBufferedPaintBits(hPaintBuffer, &prgbQuad, &cxRow); - if (SUCCEEDED(hr)) - { - DWORD* pargb = (DWORD*)prgbQuad; - if (!HasAlpha(pargb, sizeIcon, cxRow)) - { - ICONINFO info; - if (::GetIconInfo(hIcon, &info)) - { - if (info.hbmMask) - { - hr = ConvertToPARGB32(hDC, pargb, info.hbmMask, sizeIcon, cxRow); - } - - ::DeleteObject(info.hbmColor); - ::DeleteObject(info.hbmMask); - } - } - } - - return hr; -} - -bool CIconBitmapUtils::HasAlpha(DWORD* pargb, SIZE& sizeImage, int cxRow) -{ - ULONG cxDelta = cxRow - sizeImage.cx; - for (ULONG y = sizeImage.cy; y; --y) - { - for (ULONG x = sizeImage.cx; x; --x) - { - if (*pargb++ & 0xFF000000) - { - return true; - } - } - - pargb += cxDelta; - } - - return false; -} - -HRESULT CIconBitmapUtils::ConvertToPARGB32(HDC hDC, DWORD* pargb, HBITMAP hBitmap, - SIZE& sizeImage, int cxRow) -{ - BITMAPINFO bmi; - ::SecureZeroMemory(&bmi, sizeof(BITMAPINFO)); - bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); - bmi.bmiHeader.biPlanes = 1; - bmi.bmiHeader.biCompression = BI_RGB; - - bmi.bmiHeader.biWidth = sizeImage.cx; - bmi.bmiHeader.biHeight = sizeImage.cy; - bmi.bmiHeader.biBitCount = 32; - - HRESULT hr = E_OUTOFMEMORY; - HANDLE hHeap = ::GetProcessHeap(); - void *pvBits = ::HeapAlloc(hHeap, 0, - bmi.bmiHeader.biWidth * 4 * bmi.bmiHeader.biHeight); - if (pvBits) - { - hr = E_UNEXPECTED; - if (::GetDIBits(hDC, hBitmap, 0, bmi.bmiHeader.biHeight, pvBits, &bmi, - DIB_RGB_COLORS) == bmi.bmiHeader.biHeight) - { - ULONG cxDelta = cxRow - bmi.bmiHeader.biWidth; - DWORD* pargbMask = (DWORD*)pvBits; - - for (ULONG y = bmi.bmiHeader.biHeight; y; --y) - { - for (ULONG x = bmi.bmiHeader.biWidth; x; --x) - { - if (*pargbMask++) - { - // transparent pixel - *pargb++ = 0; - } - else - { - // opaque pixel - *pargb++ |= 0xFF000000; - } - } - pargb += cxDelta; - } - hr = S_OK; - } - - ::HeapFree(hHeap, 0, pvBits); - } - - return hr; -}
Change 1 of 1 Show Entire File win32/​shellext/​IconBitmapUtils.h Stacked
 
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
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
@@ -1,59 +0,0 @@
-// Copyright (C) 2011 Fog Creek Software -// Copyright (C) 2009 TortoiseSVN -// -// 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, -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -// - -// Adapted for use in TortoiseHg by Veniamin Albaev - -#pragma once -#include <uxtheme.h> - -typedef HRESULT (WINAPI *FN_GetBufferedPaintBits) (HPAINTBUFFER hBufferedPaint, - RGBQUAD **ppbBuffer, int *pcxRow); -typedef HPAINTBUFFER (WINAPI *FN_BeginBufferedPaint) (HDC hdcTarget, - const RECT *prcTarget, BP_BUFFERFORMAT dwFormat, BP_PAINTPARAMS *pPaintParams, - HDC *phdc); -typedef HRESULT (WINAPI *FN_EndBufferedPaint) (HPAINTBUFFER hBufferedPaint, - BOOL fUpdateTarget); - - -/** - * \ingroup utils - * provides helper functions for converting icons to bitmaps - */ -class CIconBitmapUtils -{ -public: - CIconBitmapUtils(); - ~CIconBitmapUtils(); - - HBITMAP IconToBitmap(HICON hIcon); - HBITMAP IconToBitmapPARGB32(HICON hIcon); - HRESULT Create32BitHBITMAP(HDC hDC, const SIZE *pSize, void **ppvBits, - HBITMAP* phBitmap); - HRESULT ConvertBufferToPARGB32(HPAINTBUFFER hPaintBuffer, HDC hDC, HICON hIcon, - SIZE& sizeIcon); - bool HasAlpha(DWORD *pargb, SIZE& sizeImage, int cxRow); - HRESULT ConvertToPARGB32(HDC hDC, DWORD* pargb, HBITMAP hBitmap, - SIZE& sizeImage, int cxRow); - -private: - HMODULE m_hUxTheme; - - FN_GetBufferedPaintBits m_pfnGetBufferedPaintBits; - FN_BeginBufferedPaint m_pfnBeginBufferedPaint; - FN_EndBufferedPaint m_pfnEndBufferedPaint; -};
Change 1 of 1 Show Entire File win32/​shellext/​QueryDirstate.cpp Stacked
 
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
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
@@ -1,400 +0,0 @@
-// Copyright (C) 2011 Fog Creek Software -// Copyright (C) 2009 Benjamin Pollack -// Copyright (C) 2009 Adrian Buehlmann -// -// 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, see <http://www.gnu.org/licenses/>. - -#include "stdafx.h" - -#include "QueryDirstate.h" -#include "Dirstate.h" -#include "DirectoryStatus.h" -#include "Dirstatecache.h" -#include "Winstat.h" -#include "TortoiseUtils.h" -#include "THgStatus.h" - -class CQueryState -{ -public: - CString strPath; - bool bIsDir; - CString strBaseDir; - CString strHgRoot; - - char chStatus; - unsigned uTickCount; - - CQueryState() : bIsDir(false), chStatus('0'), uTickCount(0) {} -}; - - -bool HasHgDir(char chClass, const CString& strPath, unsigned& uTicks) -{ - uTicks = 0; - - bool bRes = false; - - if (strPath.IsEmpty() || strPath == "\\") return bRes; - - CString strHgPath = strPath + "\\.hg"; - - if (::PathIsUNCServerShare(strHgPath)) return bRes; - - unsigned tc0 = ::GetTickCount(); - bRes = ::PathIsDirectory(strHgPath) != 0; - unsigned tc1 = ::GetTickCount(); - - uTicks = tc1 - tc0; - - if (uTicks > 5 /* ms */) - { - // trace slower PathIsDirectory calls (untypical on local discs) - ATLTRACE("[%c] HasHgDir: PathIsDirectory('%s') -> %d, in %d ticks\n", - chClass, (LPCTSTR)strHgPath, (int)bRes, uTicks); - } - - return bRes; -} - - -int FindHgRoot(char chClass, CQueryState& qsCur, CQueryState& qsLast, bool bOutdated) -{ - CString dp = "["; dp += chClass; dp += "] findHgRoot"; - - { - CString strPath = qsCur.strPath; - strPath.AppendChar('\\'); - bool bUnset = false; - if (strPath.Find("\\.hg\\") != -1) - { - // ignore files and dirs named '.hg' - qsLast = qsCur; - return 0; - } - int nPos; - if ((nPos = strPath.Find("\\.kbf\\")) != -1) - { - strPath.Truncate(nPos); - strPath += "\\.hg\\kilnbfiles\\dirstate"; - CWinstat stat; - if (stat.lstat(strPath, true) == 0) - { - // ignore files and dirs named '.kbf' when kbfiles is enabled - qsLast = qsCur; - return 0; - } - } - } - - if (!bOutdated && !qsLast.strHgRoot.IsEmpty() - && qsCur.strPath.GetLength() >= qsLast.strHgRoot.GetLength() - && StartsWith(qsCur.strPath, qsLast.strHgRoot + "\\")) - { - qsCur.strHgRoot = qsLast.strHgRoot; - return 1; - } - - unsigned uTicks = 0; -#ifdef _DEBUG - bool bFileAccessIsUnacceptablySlow = false; -#endif - - if (!::PathIsNetworkPath(qsCur.strPath)) - { - // checking if we have a repo root, visible from its parent dir - bool bHasHg = HasHgDir(chClass, qsCur.strPath, uTicks); - - if (uTicks > 5000 /* ms */) - { -#ifdef _DEBUG - bFileAccessIsUnacceptablySlow = true; -#endif - goto exit; - } - - if (bHasHg) - { - qsCur.strHgRoot = qsCur.strPath; - ATLTRACE("%s('%s'): hgroot = cur.path\n", (LPCTSTR)dp, (LPCTSTR)qsCur.strPath); - return 1; - } - } - - qsCur.strBaseDir = DirName(qsCur.strPath); - - if (!bOutdated && !qsLast.strBaseDir.IsEmpty() && qsCur.strBaseDir == qsLast.strBaseDir) - { - qsCur.strHgRoot = qsLast.strHgRoot; - return 1; - } - - for (CString strPath = qsCur.strBaseDir;;) - { - bool bHasHg = HasHgDir(chClass, strPath, uTicks); - if (uTicks > 5000 /* ms */) - { - CString strReason = "ignoring slow \"" + strPath + "\""; - CTHgStatus::Error(strReason); -#ifdef _DEBUG - bFileAccessIsUnacceptablySlow = true; -#endif - goto exit; - } - - if (bHasHg) - { - qsCur.strHgRoot = strPath; - ATLTRACE("%s('%s'): hgroot = '%s' (found repo)", (LPCTSTR)dp, - (LPCTSTR)qsCur.strPath, (LPCTSTR)qsCur.strHgRoot); - return 1; - } - CString strPath2 = DirName(strPath); - if (strPath2.GetLength() == strPath.GetLength()) - break; - strPath = strPath2; - } - -exit: -#ifdef _DEBUG - if (bFileAccessIsUnacceptablySlow) - { - ATLTRACE("****** %s('%s'): ignored, call took too long (%d ticks)\n", - (LPCTSTR)dp, (LPCTSTR)qsCur.strPath, uTicks); - } - else - { - ATLTRACE("%s('%s'): NO repo found\n", (LPCTSTR)dp, (LPCTSTR)qsCur.strPath); - } -#endif - qsLast = qsCur; - return 0; -} - -int GetRelPath(const CString& strHgRoot, const CString& strPath, CString& strRes) -{ - int nOffset = strHgRoot.GetLength(); - if (nOffset == 0) return 0; - if (nOffset > strPath.GetLength()) return 0; - if (strPath[nOffset] == '\\') nOffset++; - - strRes = strPath.Mid(nOffset); - return 1; -} - -int GetHgRoot(const CString &strPath, CString& strHgRoot) -{ - static CQueryState qsLast; - - if (strPath.IsEmpty()) return 0; - - CQueryState qsCur; - - qsCur.strPath = strPath; - qsCur.uTickCount = ::GetTickCount(); - - bool bOutdated = qsCur.uTickCount - qsLast.uTickCount > 2000; - - if (!bOutdated && qsLast.strPath == strPath) - { - strHgRoot = qsLast.strHgRoot; - return 1; - } - - if (::PathIsRoot(strPath)) - { - qsLast = qsCur; - return 0; - } - - if (FindHgRoot('0', qsCur, qsLast, bOutdated) == 0) return 0; - if (qsCur.strHgRoot.IsEmpty()) return 0; - - strHgRoot = qsCur.strHgRoot; - return 1; -} - -int HgQueryDirstate(char chClass, const CString& strPath, char chFilterStatus, - char& chOutStatus) -{ - CString dp = "["; dp += chClass; dp += "] HgQueryDirstate: "; - - static CQueryState qsLast; - - if (strPath.IsEmpty()) return 0; - - CQueryState qsCur; - - qsCur.strPath = strPath; - qsCur.uTickCount = ::GetTickCount(); - - bool bOutdated = qsCur.uTickCount - qsLast.uTickCount > 2000; - - if (!bOutdated && qsLast.strPath == strPath) - { - chOutStatus = qsLast.chStatus; - if (chOutStatus == 'P') - chOutStatus = 'M'; - return 1; - } - - if (::PathIsRoot(strPath)) - { - qsLast = qsCur; - return 0; - } - - if (FindHgRoot(chClass, qsCur, qsLast, bOutdated) == 0) return 0; - - int nOffset = qsCur.strHgRoot.GetLength(); - if (nOffset == 0) - { - qsLast = qsCur; - return 0; - } - - if (strPath[nOffset] == '\\') - nOffset++; - CString strRelPath = strPath.Mid(nOffset); - - for (int i = 0; i < strRelPath.GetLength(); ++i) - { - if (strRelPath[i] == '\\') strRelPath.SetAt(i, '/'); - } - - CDirectoryStatus* pDirStatus = CDirectoryStatus::Get(qsCur.strHgRoot, qsCur.strBaseDir); - if (pDirStatus && pDirStatus->NoIcons()) - { - qsLast = qsCur; - return 0; - } - - if (strRelPath.IsEmpty()) - { - chOutStatus = (pDirStatus ? pDirStatus->Status(strRelPath) : '?'); - qsCur.chStatus = chOutStatus; - qsCur.uTickCount = ::GetTickCount(); - qsLast = qsCur; - return 1; - } - - bool bUnset = false; - - CDirstate* pDirstate = CDirstateCache::Get(qsCur.strHgRoot, qsCur.strBaseDir, bUnset); - if (!pDirstate) - { - ATLTRACE("%s Dirstatecache::Get('%s') returns no Dirstate\n", (LPCTSTR)dp, - (LPCTSTR)qsCur.strHgRoot); - qsLast = qsCur; - return 0; - } - - CWinstat stat; - if (0 != stat.lstat(strPath)) - { - ATLTRACE("%s lstat('%s') failed", (LPCTSTR)dp, (LPCTSTR)strPath); - qsLast = qsCur; - return 0; - } - qsCur.bIsDir = stat.bIsDir; -#if 0 - ATLTRACE("%s stat.lstat('%s') -> stat.bIsDir is %d\n" << (LPCTSTR)dp, - (LPCTSTR)qsCur.strPath, (int)stat.bIsDir); -#endif - - if (qsCur.bIsDir) - { - if (!strRelPath.IsEmpty() && !pDirstate->Root().GetDir(strRelPath)) - { - // attempt to get status from kbfiles - pDirstate = CDirstateCache::Get(qsCur.strHgRoot, qsCur.strBaseDir, bUnset, true); - if (!pDirstate || !pDirstate->Root().GetDir(strRelPath)) - { - qsLast = qsCur; - return 0; // unknown dir -> no icon - } - } - - chOutStatus = (pDirStatus ? pDirStatus->Status(strRelPath) : '?'); - qsCur.chStatus = chOutStatus; - qsCur.uTickCount = ::GetTickCount(); - qsLast = qsCur; - return 1; - } - - const CDirentry* e = pDirstate->Root().Get(strRelPath); - if (!e) - { - // attempt to get status from kbfiles - pDirstate = CDirstateCache::Get(qsCur.strHgRoot, qsCur.strBaseDir, bUnset, true); - if (pDirstate) - { - e = pDirstate->Root().Get(strRelPath); - } - if (!e) - { - qsLast = qsCur; - return 0; - } - } - - chOutStatus = e->Status(stat); - - if (bUnset) goto exit; - - bool bUpdate = false; - - if (chOutStatus == 'M') - { - CString strRelBase; - if (pDirStatus && GetRelPath(qsCur.strHgRoot, qsCur.strBaseDir, strRelBase)) - { - ATLTRACE("%s strRelBase = '%s'\n", (LPCTSTR)dp, (LPCTSTR)strRelBase); - - char chBaseDirStatus = pDirStatus->Status(strRelBase); - ATLTRACE("%s chBaseDirStatus = '%c'\n", (LPCTSTR)dp, chBaseDirStatus); - - if (chBaseDirStatus != 'M') bUpdate = true; - } - } - else if (chOutStatus == 'P') - { - static unsigned uLastTickCount; - - unsigned tc = ::GetTickCount(); - bool bOutdated = tc - uLastTickCount > 6000; - - if (bOutdated) // protect against endless update loops - { - bUpdate = true; - uLastTickCount = tc; - } - - ATLTRACE("%s chOutStatus is 'P'\n", (LPCTSTR)dp); - } - - if (bUpdate) - { - ATLTRACE("%s calling CTHgStatus::Update\n", (LPCTSTR)dp); - CTHgStatus::Update(strPath); - } - - exit: - qsCur.chStatus = chOutStatus; - if (chOutStatus == 'P') - chOutStatus = 'M'; - qsCur.uTickCount = ::GetTickCount(); - qsLast = qsCur; - return 1; -}
Change 1 of 1 Show Entire File win32/​shellext/​QueryDirstate.h Stacked
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
@@ -1,21 +0,0 @@
-// Copyright (C) 2011 Fog Creek Software -// -// 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, see <http://www.gnu.org/licenses/>. - -#pragma once - -int GetHgRoot(const CString& strPath, CString& strHgRoot); -int GetRelPath(const CString& strHgRoot, const CString& strPath, CString& strRes); -int HgQueryDirstate(char chClass, const CString& strPath, char chFilterStatus, - char& chOutStatus);
Change 1 of 1 Show Entire File win32/​shellext/​RegistryConfig.cpp Stacked
 
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
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
@@ -1,58 +0,0 @@
-// Copyright (C) 2011 Fog Creek Software -// -// 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, see <http://www.gnu.org/licenses/>. - -#include "stdafx.h" - -#include "RegistryConfig.h" -#include "TortoiseUtils.h" - -bool GetRegistryConfig(const CString& strName, CString& strRes) -{ - CRegKey key; - LONG lRes = key.Open(HKEY_CURRENT_USER, "Software\\TortoiseHg", KEY_READ); - if (lRes != ERROR_SUCCESS || key.m_hKey == NULL) return false; - - DWORD cbData = MAX_PATH; - TCHAR szData[MAX_PATH]; - lRes = key.QueryStringValue(strName, szData, &cbData); - if (lRes != ERROR_SUCCESS) return false; - strRes = szData; - return true; -} - -void GetCMenuTranslation(const CString& strLang, LPCTSTR lpszName, - CStringW& strMenuText, CStringW& strHelpText) -{ - CString strSubKey = L"Software\\TortoiseHg\\CMenu\\"; - strSubKey += strLang; - strSubKey += L"\\"; - strSubKey += lpszName; - - ATLTRACE("GetCMenuTranslation: '%s'\n", (LPCTSTR)strSubKey); - - CRegKey key; - LONG lRes = key.Open(HKEY_CURRENT_USER, strSubKey, KEY_READ); - - if (lRes == ERROR_SUCCESS && key.m_hKey != NULL) - { - GetRegSZValueW(key, L"menuText", strMenuText); - GetRegSZValueW(key, L"helpText", strHelpText); - } - else - { - ATLTRACE("GetCMenuTranslation: RegOpenKeyExW('%s') failed\n", - (LPCTSTR)strSubKey); - } -}
Change 1 of 1 Show Entire File win32/​shellext/​RegistryConfig.h Stacked
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
@@ -1,20 +0,0 @@
-// Copyright (C) 2011 Fog Creek Software -// -// 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, see <http://www.gnu.org/licenses/>. - -#pragma once - -bool GetRegistryConfig(const CString& strName, CString& strRes); -void GetCMenuTranslation(const CString& strLang, LPCTSTR lpszName, - CStringW& strMenuText, CStringW& strHelpText);
Change 1 of 1 Show Entire File win32/​shellext/​StringUtils.cpp Stacked
 
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
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
@@ -1,28 +0,0 @@
-// Copyright (C) 2011 Fog Creek Software -// Copyright (C) 2002 Torsten Martinsen -// <torsten@tiscali.dk> - September 2002 -// -// 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - -#include "stdafx.h" - -#include "StringUtils.h" - -// Quotes a string -CString Quote(const CString& str) -{ - CString strResult = "\"" + str + "\""; - return strResult; -}
Change 1 of 1 Show Entire File win32/​shellext/​StringUtils.h Stacked
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
@@ -1,22 +0,0 @@
-// Copyright (C) 2011 Fog Creek Software -// Copyright (C) 2002 Francis Irving -// <francis@flourish.org> - May 2002 -// -// 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - -#pragma once - -// Quotes a string -CString Quote(const CString& str);
Change 1 of 1 Show Entire File win32/​shellext/​SysInfo.cpp Stacked
 
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
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
@@ -1,31 +0,0 @@
-// Copyright (C) 2011 Fog Creek Software -// Copyright (C) 2008 TortoiseSVN -// -// 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, -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - -#include "stdafx.h" - -#include "SysInfo.h" - -CSysInfo CSysInfo::m_inst; - -CSysInfo::CSysInfo(void) -{ - OSVERSIONINFO osvi; - memset(&osvi, 0, sizeof(OSVERSIONINFO)); - osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); - ::GetVersionEx(&osvi); - m_dwFullVersion = (DWORD)MAKEWORD(osvi.dwMinorVersion, osvi.dwMajorVersion); -}
Change 1 of 1 Show Entire File win32/​shellext/​SysInfo.h Stacked
 
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
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
@@ -1,37 +0,0 @@
-// Copyright (C) 2011 Fog Creek Software -// Copyright (C) 2008 TortoiseSVN -// -// 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, -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - -#pragma once - -// This class handles system information. -class CSysInfo -{ -private: - CSysInfo(); - -public: - static DWORD GetFullVersion() { return m_inst.m_dwFullVersion; } - static bool IsXP() { return (GetFullVersion() < 0x0600); } // cover Win5.1 and 5.2 alike - static bool IsVista() { return (GetFullVersion() == 0x0600); } - static bool IsVistaOrLater() { return (GetFullVersion() >= 0x0600); } - static bool IsWin7() { return (GetFullVersion() == 0x0601); } - static bool IsWin7OrLater() { return (GetFullVersion() >= 0x0601); } - -private: - static CSysInfo m_inst; - DWORD m_dwFullVersion; -};
Change 1 of 1 Show Entire File win32/​shellext/​ThgShell.iss Stacked
 
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
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
@@ -1,35 +0,0 @@
-[Setup] -AppCopyright=Copyright 2007 TK Soh and others -AppName=TortoiseHg -AppVerName=TortoiseHg snapshot -;InfoAfterFile=iss/postinstall.txt -;LicenseFile=COPYING.txt -ShowLanguageDialog=yes -AppPublisher=TK Soh and others -AppPublisherURL=http://tortoisehg.sourceforge.net/ -AppSupportURL=http://tortoisehg.sourceforge.net/ -AppUpdatesURL=http://tortoisehg.sourceforge.net/ -AppID=TortoiseHg -AppContact=teekaysoh@gmail.com -OutputBaseFilename=THgShell_setup -DefaultDirName={sd}\TortoiseHg -;SourceDir=. -VersionInfoDescription=TortoiseHg -VersionInfoCopyright=Copyright 2007 TK Soh and others -VersionInfoCompany=TK Soh and others -InternalCompressLevel=max -SolidCompression=true -;SetupIconFile=icons\hg.ico -AllowNoIcons=true -DefaultGroupName=TortoiseHg -PrivilegesRequired=poweruser -;AlwaysRestart=yes -SetupLogging=yes -ArchitecturesInstallIn64BitMode = x64 - -[Files] -Source: THgShell.dll; DestDir: {app}; Flags: ignoreversion -Source: hgtk.cmd; DestDir: {app}; Flags: ignoreversion -Source: ..\..\icons\*; DestDir: {app}\icons ; Flags: ignoreversion recursesubdirs createallsubdirs - -#include "../../contrib/win32/registry.iss"
Change 1 of 1 Show Entire File win32/​shellext/​TortoiseIconBitmap.cpp Stacked
 
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
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
@@ -1,55 +0,0 @@
-// Copyright (C) 2011 Fog Creek Software -// -// 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, see <http://www.gnu.org/licenses/>. - -#include "stdafx.h" - -#include "TortoiseUtils.h" -#include "IconBitmapUtils.h" - -HBITMAP GetTortoiseIconBitmap(const CString& strIconName) -{ - CIconBitmapUtils bmpUtils; - - typedef CAtlMap<CString, HBITMAP> CBitmapCache; - static CBitmapCache bmpcache; - - const CBitmapCache::CPair* p = bmpcache.Lookup(strIconName); - if (p != NULL) return p->m_value; - - if (bmpcache.GetCount() > 200) - { - ATLTRACE("**** GetTortoiseIconBitmap: error: too many bitmaps in cache\n"); - return 0; - } - - HICON hIcon = GetTortoiseIcon(strIconName); - if (!hIcon) return 0; - - HBITMAP hBitmap = bmpUtils.IconToBitmapPARGB32(hIcon); - if (!hBitmap) - { - ATLTRACE("**** GetTortoiseIconBitmap: error: something wrong in " - "bmpUtils.ConvertToPARGB32(hIcon)\n"); - return 0; - } - - bmpcache[strIconName] = hBitmap; - - ATLTRACE("GetTortoiseIconBitmap: added '%s' to bmpcache_ (%d bitmaps in cache)\n", - (LPCTSTR)strIconName, bmpcache.GetCount()); - - return hBitmap; -} -
Change 1 of 1 Show Entire File win32/​shellext/​TortoiseIconBitmap.h Stacked
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
@@ -1,18 +0,0 @@
-// Copyright (C) 2011 Fog Creek Software -// -// 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, see <http://www.gnu.org/licenses/>. - -#pragma once - -HBITMAP GetTortoiseIconBitmap(const CString& strIconName);
Change 1 of 1 Show Entire File win32/​shellext/​TortoiseUtils.cpp Stacked
 
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
200
201
202
203
204
205
206
207
208
209
210
211
212
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
@@ -1,212 +0,0 @@
-// Copyright (C) 2011 Fog Creek Software -// -// 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, see <http://www.gnu.org/licenses/>. - -#include "stdafx.h" - -#include "TortoiseUtils.h" - -#include <io.h> -#include <fcntl.h> - -CString GetTHgProgRoot() -{ - LPCTSTR lpszKeyName = "Software\\TortoiseHg"; - HKEY hKey = HKEY_LOCAL_MACHINE; - TCHAR lpszValue[MAX_PATH] = ""; - LONG lpcbLonger = MAX_PATH * sizeof(TCHAR); - - if (::RegQueryValue(hKey, lpszKeyName, lpszValue, &lpcbLonger) != ERROR_SUCCESS) - { - return ""; - } - - return lpszValue; -} - -// Start an external command -// Note: if the command is a batch file and the [full] path to the -// batch contains spaces, the path must be double-quoted. -// (see http://www.encocoservices.com/createprocess.html) -bool LaunchCommand(const CString& strCommand, const CString& strCwd) -{ - ATLTRACE("LaunchCommand: %s\n", (LPCTSTR)strCommand); - ATLTRACE("LaunchCommand: in '%s'\n", (LPCTSTR)strCwd); - PROCESS_INFORMATION pi; - memset(&pi, 0, sizeof(PROCESS_INFORMATION)); - - STARTUPINFOA si; - memset(&si, 0, sizeof(STARTUPINFO)); - - BOOL bRes = ::CreateProcess( - NULL, // No module name, use command line - (LPTSTR)(LPCTSTR)strCommand, - NULL, // Process handle not inherited - NULL, // Thread handle not inherited - FALSE, - CREATE_NO_WINDOW, - NULL, // use parent's environment - strCwd, - &si, - &pi); - - if (bRes == 0) - { - ATLTRACE("LaunchCommand: failed to launch\n"); - return false; - } - - ::CloseHandle(pi.hProcess); - ::CloseHandle(pi.hThread); - return true; -} - -CString DirName(const CString& strFileName) -{ - if (strFileName.IsEmpty()) return strFileName; - int nPos = strFileName.ReverseFind('\\'); - if (nPos == -1) return ""; - CString strDirName = strFileName.Left(nPos); - if (!strDirName.IsEmpty() && strDirName[strDirName.GetLength()-1] == ':') - { - strDirName.AppendChar('\\'); - } - return strDirName; -} - -CString BaseName(const CString& strFileName) -{ - if (strFileName.IsEmpty()) return strFileName; - int nPos = strFileName.ReverseFind('\\'); - if (nPos == -1) return strFileName; - return strFileName.Mid(nPos+1); -} - -// not reentrant -HICON GetTortoiseIcon(const CString& strIconName) -{ - typedef CAtlMap<CString, HICON> CIconCache; - static CIconCache iconcache; - - CString thgdir = GetTHgProgRoot(); - if (thgdir.IsEmpty()) - { - ATLTRACE("GetTortoiseIcon: THG root is empty\n"); - return 0; - } - - CString strIconPath = thgdir + "\\icons\\" + strIconName; - - const CIconCache::CPair* p = iconcache.Lookup(strIconName); - if (p != NULL) return p->m_value; - - if (iconcache.GetCount() > 200) - { - ATLTRACE("**** GetTortoiseIcon: error: too many icons in cache\n"); - return 0; - } - - HICON hIcon = (HICON)::LoadImage(0, strIconPath, IMAGE_ICON, - 16, 16, LR_LOADFROMFILE); - if (!hIcon) - { - ATLTRACE("GetTortoiseIcon: can't find '%s'\n", (LPCTSTR)strIconPath); - return 0; - } - - iconcache[strIconPath] = hIcon; - - ATLTRACE("GetTortoiseIcon: added '%s' to iconcache_ (%d icons in cache)\n", - (LPCTSTR)strIconPath, iconcache.GetCount()); - - return hIcon; -} - -CString GetHgRepoRoot(LPCTSTR lpszPath) -{ - ATLTRACE("GetHgRepoRoot('%s')\n", lpszPath); - - CString strPath = (::PathIsUNCServerShare(lpszPath) || ::PathIsDirectory(lpszPath)) ? - lpszPath : DirName(lpszPath); - for (;;) - { - CString strHgDir = strPath + "\\.hg"; - if (::PathIsUNCServerShare(strHgDir)) - { - ATLTRACE("GetHgRepoRoot: tdir is UNC share '%s'\n", (LPCTSTR)strHgDir); - strPath.Empty(); - break; - } - else if (::PathIsDirectory(strHgDir)) - { - break; - } - CString strOldPath = strPath; - strPath = DirName(strPath); - if (strPath == strOldPath) - { - strPath.Empty(); - break; - } - } - - ATLTRACE("GetHgRepoRoot: returning '%s'\n", (LPCTSTR)strPath); - return strPath; -} - -bool IsHgRepo(LPCTSTR lpszPath) -{ - return !GetHgRepoRoot(lpszPath).IsEmpty(); -} - -// read string value from registry, wide version -bool GetRegSZValueW(HKEY hKey, LPCWSTR lpszName, CStringW& strRes) -{ - strRes = L""; - if (!hKey) return 0; - - DWORD cbData = 600; - LPWSTR lpszData = strRes.GetBuffer(cbData); - LONG lRes = ::RegQueryValueExW(hKey, lpszName, 0, 0, (LPBYTE)lpszData, &cbData); - strRes.ReleaseBuffer(cbData); - - if (lRes == ERROR_SUCCESS) return true; - ATLTRACE(L"GetRegSZValueW('%s') failed\n", lpszName); - return false; -} - -// true if a starts with b -bool StartsWith(const CString& strWhole, const CString& strPrefix) -{ - if (strWhole.IsEmpty() || strPrefix.IsEmpty()) return false; - if (strPrefix.GetLength() > strWhole.GetLength()) return false; - - for (int i = 0; i < strPrefix.GetLength(); ++i) - { - if (strWhole[i] != strPrefix[i]) return false; - } - - return true; -} - -void Tokenize(CString str, CAtlList<CString>& rTokens, LPCTSTR lpszDelimiters) -{ - int nPos = 0; - CString strToken = str.Tokenize(lpszDelimiters, nPos); - while (!strToken.IsEmpty()) - { - rTokens.AddTail(strToken); - strToken = str.Tokenize(lpszDelimiters, nPos); - } -}
Change 1 of 1 Show Entire File win32/​shellext/​TortoiseUtils.h Stacked
 
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
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
@@ -1,27 +0,0 @@
-// Copyright (C) 2011 Fog Creek Software -// -// 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, see <http://www.gnu.org/licenses/>. - -#pragma once - -CString GetTHgProgRoot(); -CString DirName(const CString& strFileName); -CString BaseName(const CString& strFileName); -bool LaunchCommand(const CString& strCommand, const CString& strCwd); -HICON GetTortoiseIcon(const CString& strIconName); -CString GetHgRepoRoot(LPCTSTR lpszPath); -bool IsHgRepo(const CString& lpszPath); -bool GetRegSZValueW(HKEY hKey, LPCWSTR lpszName, CStringW& strRes); -bool StartsWith(const CString& strWhole, const CString& strPrefix); -void Tokenize(CString str, CAtlList<CString>& rTokens, LPCTSTR lpszDelimiters = " ");
Change 1 of 1 Show Entire File win32/​shellext/​Winstat.cpp Stacked
 
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
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
@@ -1,45 +0,0 @@
-// Copyright (C) 2011 Fog Creek Software -// Copyright (C) 2009 Benjamin Pollack -// -// 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, see <http://www.gnu.org/licenses/>. - -#include "stdafx.h" - -#include "Winstat.h" - -int CWinstat::lstat(LPCTSTR lpszFile, bool bTime64) -{ - const ULONGLONG llDaysBetweenEpochs = 134774L; /* days between 1.1.1601 and 1.1.1970 */ - const ULONGLONG llSecsBetweenEpochs = llDaysBetweenEpochs * 86400L; - const ULONGLONG llDivisor = 10000000L; - - WIN32_FIND_DATA data; - HANDLE hFind; - - hFind = ::FindFirstFile(lpszFile, &data); - if (hFind == INVALID_HANDLE_VALUE) return -1; - ::FindClose(hFind); - - ullMTime = (((ULONGLONG)data.ftLastWriteTime.dwHighDateTime << 32) + - data.ftLastWriteTime.dwLowDateTime); - if (!bTime64) - { - ullMTime /= llDivisor; - ullMTime -= llSecsBetweenEpochs; - } - ullSize = ((ULONGLONG)data.nFileSizeHigh << 32) + data.nFileSizeLow; - bIsDir = (data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0; - - return 0; -}
Change 1 of 1 Show Entire File win32/​shellext/​Winstat.h Stacked
 
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
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
@@ -1,27 +0,0 @@
-// Copyright (C) 2011 Fog Creek Software -// Copyright (C) 2009 Benjamin Pollack -// -// 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, see <http://www.gnu.org/licenses/>. - -#pragma once - -class CWinstat -{ -public: - ULONGLONG ullSize; - ULONGLONG ullMTime; - bool bIsDir; - - int lstat(LPCTSTR lpszFile, bool bTime64 = false); -};
Change 1 of 1 Show Entire File win32/​shellext/​stdafx.h Stacked
 
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
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
@@ -1,37 +0,0 @@
-// Copyright (C) 2011 Fog Creek Software -// -// 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, see <http://www.gnu.org/licenses/>. - -#pragma once - -// WINVER must be defined as at least 0x0500 in order to have access to the hbmpItem -// member in MENUITEMINFO. -#define WINVER 0x0500 - -// Enable visual styles of Windows XP. -#define ISOLATION_AWARE_ENABLED 1 -#pragma comment(linker, "/manifestdependency:\"type='win32' " \ - "name='Microsoft.Windows.Common-Controls' version='6.0.0.0' " \ - "processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"") - -#include "resource.h" - -#include <atlbase.h> -extern CComModule _Module; -#include <atlcom.h> -#include <atlwin.h> -#include <atlstr.h> -#include <atlcoll.h> -#include <atlfile.h> -#include <shlobj.h>
Change 1 of 1 Show Entire File win32/​shellext/​terminate.cpp Stacked
 
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
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
@@ -1,68 +0,0 @@
-// Copyright (C) 2011 Fog Creek Software -// -// 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, see <http://www.gnu.org/licenses/>. - -#include "stdafx.h" - -#include "THgStatus.h" - -#include <tlhelp32.h> - -#define TIMEOUT_VALUE 5000 -#define EXECUTABLE_NAME "TortoiseHgOverlayServer.exe" - -// This library implements a custom action for Windows Installer that terminates -// the overlay icon server. -extern "C" UINT __stdcall TerminateIconServer() -{ - // Enumerate processes to attempt to find the overlay icon server. - HANDLE hProcess = NULL; - HANDLE hSnapshot = ::CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0L); - if (hSnapshot != NULL) - { - PROCESSENTRY32 pe; - pe.dwSize = sizeof(PROCESSENTRY32); - if (::Process32First(hSnapshot, &pe)) - { - do - { - CString strExeName(pe.szExeFile); - if (strExeName.CompareNoCase(EXECUTABLE_NAME) == 0) - { - hProcess = ::OpenProcess(SYNCHRONIZE, FALSE, pe.th32ProcessID); - break; - } - } while(::Process32Next(hSnapshot, &pe)); - } - ::CloseHandle(hSnapshot); - } - - // Attempt to terminate the server. - if(CTHgStatus::Terminate() == 0) - { - if (hProcess != NULL) - { - ::WaitForSingleObject(hProcess, TIMEOUT_VALUE); - ::CloseHandle(hProcess); - } - else - { - // If a process handle is not available but the server was running, - // stall for a brief time to allow the server to terminate. - ::Sleep(TIMEOUT_VALUE); - } - } - - return ERROR_SUCCESS; -}
Change 1 of 1 Show Entire File win32/​shellext/​terminate.def Stacked
 
1
2
 
 
 
@@ -1,2 +0,0 @@
-EXPORTS - TerminateIconServer
Change 1 of 1 Show Entire File win32/​wix/​TortoiseOverlaysDefines.wxi Stacked
 
1
2
3
4
5
6
7
8
 
 
 
 
 
 
 
 
 
@@ -1,8 +0,0 @@
-<Include> - <?define TOverlaysVersion = 1.1.2.19334 ?> - <?define TOverlaysSrcDir = ..\contrib\TortoiseOverlays ?> - <?define TOverlaysSrcFilenameX86 = TortoiseOverlays-$(var.TOverlaysVersion)-win32.msm ?> - <?define TOverlaysSrcFilenameX64 = TortoiseOverlays-$(var.TOverlaysVersion)-x64.msm ?> - - <?define TOverlaysRegistryKey = Software\TortoiseOverlays ?> -</Include>
Change 1 of 1 Show Entire File win32/​wix/​cmenu-i18n.wxs Stacked
 
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
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
@@ -1,25 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?> -<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"> - - <?include guids.wxi ?> - <?include defines.wxi ?> - - <?define thgcmenulangs = - cs;da;de;en_GB;en_US;es;fa;fr;he;hr;it;ja;ko;nl;nn;pl;pt;pt_BR;ru;tr;uk;zh_CN;zh_TW - ?> - <!-- lang 'ca' is used for key path --> - - <Fragment> - <DirectoryRef Id="i18ndir"> - <Directory Id="cmenuI18n" Name="cmenu" FileSource="$(var.SourceDir)"> - <Component Id="cmenuI18n" Guid="$(var.cmenuI18n.guid)" Win64='$(var.IsX64)'> - <File Name="thg-cmenu-ca.reg" KeyPath="yes"/> - <?foreach LANG in $(var.thgcmenulangs) ?> - <File Name="thg-cmenu-$(var.LANG).reg" /> - <?endforeach?> - </Component> - </Directory> - </DirectoryRef> - </Fragment> - -</Wix>
 
36
37
38
39
40
41
42
43
44
 
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
 
36
37
38
 
 
 
39
40
41
 
48
49
50
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
51
52
53
@@ -36,9 +36,6 @@
  <?define dist.guid = {9A429564-6BA8-4F18-ACCF-59C586364FFC} ?>   <?define imageformats.guid = {056DFB00-3EB1-4ACA-A43B-55CD5004DED1} ?>   - <!-- cmenu-i18n.wxs --> - <?define cmenuI18n.guid = {25A9DAFA-FF37-420C-9958-5920301E293A} ?> -   <!-- icons.wxs -->   <?define Icons.guid = {34369923-9610-461C-9FB3-26CA3A139836} ?>   @@ -51,22 +48,6 @@
  <?define ComponentMainExecutableGUID = {D648EC48-559C-4C66-A4CE-2D40A495DC5B} ?>   <?define ComponentWinExecutableGUID = {B4115B52-4FD3-478C-B605-D3F618287335} ?>   - <?define thgshellx86dll.guid = {728E8840-5878-4EA7-918F-281C2697ABB1} ?> - <?define thgshellx64dll.guid = {D5D1E532-CDAD-4FFD-9695-757B8A29B4BA} ?> - - <?define CmenuShellRegistrationX86.guid = {2BF442D0-EBD9-4B03-8F78-0F45C28F8AB5} ?> - <?define CmenuShellRegistrationX64.guid = {858CE519-8BA2-4E80-BBEB-591AE78384FA} ?> - - <?define OverlaysShellRegistrationX86.guid = {8505A107-D6B1-4EAF-9929-3D6E847B5FCB} ?> - <?define OverlaysShellRegistrationX64.guid = {9A678A1C-72D3-4713-AD8A-E7C08ED64DC9} ?> - <?define OverlayServerEXE.guid = {62C58746-BE5D-45F0-8AB7-2FE2AB9C57B0} ?> - - <?define KeyboardShellRegistrationX86.guid = {C179A394-03AF-4D3E-8C2E-3E4E00A7351B} ?> - <?define KeyboardShellRegistrationX64.guid = {992E4949-6F6E-4553-B8E1-723F770CCF81} ?> - - <?define CopyHookShellRegistrationX86.guid = {D0151D2D-BAF3-48CF-8273-955D4F101FFA} ?> - <?define CopyHookShellRegistrationX64.guid = {13DBBAEC-F52C-418E-AE1F-8210E01EF8DB} ?> -   <?define ExtensionVersions.guid = {4ADF436B-9B25-4D95-B6AC-88717F5A037A} ?>   <?define COPYING.guid = {09DEF174-D0AB-4E8B-8A4E-1AD5B7E4C9BD} ?>  
Change 1 of 1 Show Entire File win32/​wix/​sdk_build_extensions.cmd Stacked
 
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
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
@@ -1,26 +0,0 @@
-:: %1 - TortoiseHg Version first level -:: %2 - second level -:: %3 - third level -:: %4 - platform (x86 or x64) -:: %5 - msi product id (GUID) - -set _SDKBIN_=%PROGRAMFILES%\Microsoft SDKs\Windows\v7.0\Bin -if exist "%_SDKBIN_%" goto :ok -set _SDKBIN_=%ProgramW6432%\Microsoft SDKs\Windows\v7.0\Bin -if exist "%_SDKBIN_%" goto :ok -echo Microsoft Windows SDK 7 SP1 not installed -pause -exit 1 -:ok - -cd win32\shellext - -call "%_SDKBIN_%\SetEnv.cmd" /xp /%4 /release -set DEBUG=1 -set THG_PLATFORM=%4 -set THG_EXTRA_CPPFLAGS=/DTHG_PRODUCT_ID=%5 -set THG_EXTRA_RCFLAGS=/dTHG_VERSION_FIRST=%1 /dTHG_VERSION_SECOND=%2 /dTHG_VERSION_THIRD=%3 /dTHG_PRODUCT_ID="%5" -nmake /f Makefile.nmake clean -nmake /f Makefile.nmake -move ThgShell%4.dll .. -move terminate-%4.exe ..
Change 1 of 1 Show Entire File win32/​wix/​shell-register-cmenu.wxi Stacked
 
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
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
@@ -1,74 +0,0 @@
-<Include> - <!-- cmenu COM components --> - <RegistryValue - Root='HKCR' Key='CLSID\$(var.CLSID_TortoiseHgCmenu)' - Type='string' Value='TortoiseHg' - /> - <RegistryValue - Root='HKCR' Key='CLSID\$(var.CLSID_TortoiseHgCmenu)\InProcServer32' - Type='string' Name='ThreadingModel' Value='Apartment' - /> - <RegistryValue - Root='HKCR' Key='CLSID\$(var.CLSID_TortoiseHgDropHandler)' - Type='string' Value='TortoiseHg' - /> - <RegistryValue - Root='HKCR' Key='CLSID\$(var.CLSID_TortoiseHgDropHandler)\InProcServer32' - Type='string' Name='ThreadingModel' Value='Apartment' - /> - - <!-- cmenu registration --> - <RegistryValue - Root='HKCR' Key='Directory\shellex\ContextMenuHandlers\TortoiseHgCMenu' - Type='string' Value='$(var.CLSID_TortoiseHgCmenu)' - /> - <RegistryValue - Root='HKCR' Key='Directory\Background\shellex\ContextMenuHandlers\TortoiseHgCMenu' - Type='string' Value='$(var.CLSID_TortoiseHgCmenu)' - /> - <RegistryValue - Root='HKCR' Key='Drive\shellex\ContextMenuHandlers\TortoiseHgCMenu' - Type='string' Value='$(var.CLSID_TortoiseHgCmenu)' - /> - <RegistryValue - Root='HKCR' Key='Folder\shellex\ContextMenuHandlers\TortoiseHgCMenu' - Type='string' Value='$(var.CLSID_TortoiseHgCmenu)' - /> - <RegistryValue - Root='HKCR' Key='InternetShortcut\shellex\ContextMenuHandlers\TortoiseHgCMenu' - Type='string' Value='$(var.CLSID_TortoiseHgCmenu)' - /> - <RegistryValue - Root='HKCR' Key='LibraryLocation\shellex\ContextMenuHandlers\TortoiseHgCMenu' - Type='string' Value='$(var.CLSID_TortoiseHgCmenu)' - /> - <RegistryValue - Root='HKCR' Key='LibraryFolder\shellex\ContextMenuHandlers\TortoiseHgCMenu' - Type='string' Value='$(var.CLSID_TortoiseHgCmenu)' - /> - <RegistryValue - Root='HKCR' Key='LibraryFolder\Background\shellex\ContextMenuHandlers\TortoiseHgCMenu' - Type='string' Value='$(var.CLSID_TortoiseHgCmenu)' - /> - <RegistryValue - Root='HKCR' Key='*\shellex\ContextMenuHandlers\TortoiseHgCMenu' - Type='string' Value='$(var.CLSID_TortoiseHgCmenu)' - /> - - <!-- Drag and Drop Handler --> - <RegistryValue - Root='HKCR' Key='Directory\shellex\DragDropHandlers\TortoiseHg' - Type='string' Value='$(var.CLSID_TortoiseHgDropHandler)' - /> - - <!-- Mark all as approved --> - <RegistryValue - Root='HKLM' Key='Software\Microsoft\Windows\CurrentVersion\Shell Extensions\Approved' - Type='string' Name='$(var.CLSID_TortoiseHgCmenu)' Value='TortoiseHg' - /> - <RegistryValue - Root='HKLM' Key='Software\Microsoft\Windows\CurrentVersion\Shell Extensions\Approved' - Type='string' Name='$(var.CLSID_TortoiseHgDropHandler)' Value='TortoiseHg' - /> - -</Include>
Change 1 of 1 Show Entire File win32/​wix/​shell-register-overlays.wxi Stacked
 
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
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
@@ -1,40 +0,0 @@
-<Include> - <!-- overlay components --> - <?foreach CLSID in $(var.OverlayCLSIDList) ?> - <RegistryValue - Root='HKCR' Key='CLSID\$(var.CLSID)' - Type='string' Value='TortoiseHg' - /> - <RegistryValue - Root='HKCR' Key='CLSID\$(var.CLSID)\InProcServer32' - Type='string' Name='ThreadingModel' Value='Apartment' - /> - <?endforeach?> - - <!-- register overlay components with TortoiseOverlays --> - <RegistryValue - Root='HKLM' Key='$(var.TOverlaysRegistryKey)\Normal' - Type='string' Name='TortoiseHgMsi' Value='$(var.CLSID_TortoiseHgNormal)' - /> - <RegistryValue - Root='HKLM' Key='$(var.TOverlaysRegistryKey)\Added' - Type='string' Name='TortoiseHgMsi' Value='$(var.CLSID_TortoiseHgAdded)' - /> - <RegistryValue - Root='HKLM' Key='$(var.TOverlaysRegistryKey)\Modified' - Type='string' Name='TortoiseHgMsi' Value='$(var.CLSID_TortoiseHgModified)' - /> - <RegistryValue - Root='HKLM' Key='$(var.TOverlaysRegistryKey)\Unversioned' - Type='string' Name='TortoiseHgMsi' Value='$(var.CLSID_TortoiseHgUnversioned)' - /> - - <!-- Mark all as approved --> - <?foreach CLSID in $(var.OverlayCLSIDList) ?> - <RegistryValue - Root='HKLM' Key='Software\Microsoft\Windows\CurrentVersion\Shell Extensions\Approved' - Type='string' Name='$(var.CLSID)' Value='TortoiseHg' - /> - <?endforeach?> - -</Include>
Show Entire File win32/​wix/​tortoisehg.wxs Stacked
This file's diff was not loaded because this changeset is very large. Load changes