Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 0.8, 0.8.1, and 0.8.2

merge with crew

Changeset 9acbd89ae4f1

Parents 7c19bdf206aa

Parents bac6b73d51b3

by Adrian Buehlmann

Changes to 4 files · Browse files at 9acbd89ae4f1 Showing diff from parent 7c19bdf206aa bac6b73d51b3 Diff from another changeset...

Change 1 of 1 Show Entire File hggtk/​status.py Stacked
 
321
322
323
324
 
325
326
327
 
321
322
323
 
324
325
326
327
@@ -321,7 +321,7 @@
  col1.set_resizable(False)   self.filetree.append_column(col1)   - if self.merging: + if self.count_revs() <= 1:   col = gtk.TreeViewColumn(_('ms'), stat_cell)   col.add_attribute(stat_cell, 'text', FM_MERGE_STATUS)   col.set_sort_column_id(4)
 
116
117
118
119
 
120
121
122
 
139
140
141
142
 
143
144
145
 
164
165
166
167
 
168
169
170
 
189
190
191
192
 
193
194
195
 
116
117
118
 
119
120
121
122
 
139
140
141
 
142
143
144
145
 
164
165
166
 
167
168
169
170
 
189
190
191
 
192
193
194
195
@@ -116,7 +116,7 @@
 MenuDescriptionMap MenuDescMap;  MenuIdCmdMap MenuIdMap;   -void AddMenuList(int idCmd, std::string const& name) +void AddMenuList(int idCmd, const std::string& name)  {   TDEBUG_TRACE("AddMenuList: idCmd = " << idCmd << " name = " << name);   MenuIdMap[idCmd] = MenuDescMap[name]; @@ -139,7 +139,7 @@
 }    void InsertMenuItemWithIcon(HMENU hMenu, int indexMenu, int idCmd, - std::string const& menuText, std::string const& iconName) + const std::string& menuText, const std::string& iconName)  {   MENUITEMINFO mi;   mi.cbSize = sizeof(mi); @@ -164,7 +164,7 @@
 }    void InsertSubMenuItemWithIcon(HMENU hMenu, HMENU hSubMenu, int indexMenu, int idCmd, - std::string const& menuText, std::string const& iconName) + const std::string& menuText, const std::string& iconName)  {   MENUITEMINFO mi;   mi.cbSize = sizeof(mi); @@ -189,7 +189,7 @@
  InsertMenuItem(hMenu, indexMenu, TRUE, &mi);  }   -void InsertMenuItemByName(HMENU hMenu, std::string const& name, int indexMenu, +void InsertMenuItemByName(HMENU hMenu, const std::string& name, int indexMenu,   int idCmd, int idCmdFirst)  {   TDEBUG_TRACE("InsertMenuItemByName: name = " << name);
Change 1 of 1 Show Entire File win32/​shellext/​Makefile.nmake 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
@@ -0,0 +1,40 @@
+ +OBJECTS_DIRSTATE = TortoiseUtils.obj \ + Direntry.obj \ + Directory.obj \ + Winstat.obj + +OBJECTS_THGSGELL = $(OBJECTS_DIRSTATE) \ + ContextMenu.obj \ + IconOverlay.obj \ + ShellExt.obj \ + ShellUtils2.obj \ + StringUtils.obj \ + dirstate.obj \ + Winstat64.obj \ + Dirstatecache.obj \ + DirectoryStatus.obj \ + QueryDirstate.obj + +LIBS = User32.lib Ole32.lib Shlwapi.lib Shell32.lib Advapi32.lib +DEFFILE = ShellExt.def + + +CPPFLAGS = /nologo /Ox /W2 /EHsc /MD /DAPPMAIN +BASE_LDFLAGS = /nologo /INCREMENTAL:NO /MANIFEST $(LIBS) +LDFLAGS_THGSHELL = $(BASE_LDFLAGS) /DLL /DEF:$(DEFFILE) +LDFLAGS_DIRSTATE = $(BASE_LDFLAGS) /SUBSYSTEM:CONSOLE + + +all: THgShell.dll dirstate.exe + +clean: + del *.obj *.dll *.exe *.lib *.exp *.manifest + +THgShell.dll: $(OBJECTS_THGSGELL) + link /OUT:$@ $(LDFLAGS_THGSHELL) $** + mt -nologo -manifest $@.manifest -outputresource:"$@;#2" + +dirstate.exe: dirstate.obj $(OBJECTS_DIRSTATE) + link /OUT:$@ $(LDFLAGS_DIRSTATE) $** + mt -nologo -manifest $@.manifest -outputresource:"$@;#1"
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
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
   // 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"    #include <shlwapi.h>      class QueryState  {  public:   std::string path;   bool isdir;   std::string basedir;   std::string hgroot;     char status;   unsigned tickcount;     QueryState(): isdir(false), status(0), tickcount(0) {}  };     -bool hasHgDir(std::string const& path) +bool hasHgDir(const std::string& path)  {   return PathIsDirectory((path + "\\.hg").c_str()) != 0;  }      int findHgRoot(QueryState& cur, QueryState& last, bool outdated)  {   if (cur.isdir)   {   std::string p = cur.path;   p.push_back('\\');   if (p.find(".hg\\") != std::string::npos)   {   //TDEBUG_TRACE("findHgRoot: skipping '" << cur.path << "'");   last = cur;   return 0;   }   }     if (cur.isdir && hasHgDir(cur.path))   {   cur.hgroot = cur.path;   TDEBUG_TRACE("findHgRoot(" << cur.path << "): hgroot = cur.path");   return 1;   }     cur.basedir = DirName(cur.path);     if (!outdated && !last.basedir.empty() && cur.basedir == last.basedir)   {   cur.hgroot = last.hgroot;   // TDEBUG_TRACE("findHgRoot(" << cur.path << "): hgroot = '" << cur.hgroot   // << "' (same as last.basedir)");   return 1;   }     for (std::string p = cur.basedir;;)   {   if (hasHgDir(p)) {   cur.hgroot = p;   TDEBUG_TRACE("findHgRoot(" << cur.path << "): hgroot = '" << cur.hgroot   << "' (found repo)");   return 1;   }   std::string p2 = DirName(p);   if (p2.size() == p.size())   break;   p.swap(p2);   }     TDEBUG_TRACE("findHgRoot(" << cur.path << "): NO repo found");   last = cur;   return 0;  }      int get_relpath(   const std::string& hgroot,   const std::string& path,   std::string& res  )  {   size_t offset = hgroot.size();   if (offset == 0)   return 0;     if (offset > path.size())   return 0;     if (path[offset] == '\\')   offset++;     const char* relpathptr = path.c_str() + offset;     res = relpathptr;   return 1;  }      int HgQueryDirstate(   const std::string& path, const char& filterStatus, char& outStatus)  {   static QueryState last;     if (path.empty())   return 0;     QueryState cur;     cur.path = path;   cur.tickcount = GetTickCount();     const bool outdated = cur.tickcount - last.tickcount > 2000;     if (!outdated && last.path == path)   {   outStatus = last.status;   return 1;   }     if (PathIsRoot(path.c_str()))   {   last = cur;   return 0;   }     cur.isdir = PathIsDirectory(cur.path.c_str());     if (findHgRoot(cur, last, outdated) == 0)   return 0;     size_t offset = cur.hgroot.length();     if (offset == 0)   {   last = cur;   return 0;   }     if (path[offset] == '\\')   offset++;   const char* relpathptr = path.c_str() + offset;     std::string relpath = relpathptr;     for (size_t i = 0; i < relpath.size(); ++i)   {   if (relpath[i] == '\\')   relpath[i] = '/';   }     if (cur.isdir)   {   if (!relpath.empty())   {   Dirstate* pds2 = Dirstatecache::get(cur.hgroot, cur.basedir);   if (pds2 && !pds2->root().getdir(relpath))   return 0; // unknown dir -> no icon   }     DirectoryStatus* pds = DirectoryStatus::get(cur.hgroot, cur.basedir);   outStatus = (pds ? pds->status(relpath) : '?');   }   else   {   Dirstate* pds = Dirstatecache::get(cur.hgroot, cur.basedir);   if (!pds)   {   TDEBUG_TRACE("HgQueryDirstate: Dirstatecache::get("   << cur.hgroot << ") returns no Dirstate");   last = cur;   return 0;   }     if (filterStatus == 'A' && pds->num_added() == 0) {   last = cur;   return 0;   }     const Direntry* e = pds->root().get(relpath);   if (!e) {   last = cur;   return 0;   }     Winstat stat;   if (0 != stat.lstat(path.c_str())) {   TDEBUG_TRACE("HgQueryDirstate: lstat(" << path << ") failed");   last = cur;   return 0;   }     outStatus = e->status(stat);     if (outStatus == 'M')   {   DirectoryStatus* dirsst =   DirectoryStatus::get(cur.hgroot, cur.basedir);   if (dirsst)   {   std::string relbase;   if (get_relpath(cur.hgroot, cur.basedir, relbase))   {   TDEBUG_TRACE("HgQueryDirstate: relbase = '"   << relbase << "'");     char basedir_status = dirsst->status(relbase);   TDEBUG_TRACE("HgQueryDirstate: basedir_status = "   << basedir_status);     if (basedir_status != 'M')   {   Thgstatus::update(cur.hgroot);   }   }   }   }   }     cur.status = outStatus;   cur.tickcount = GetTickCount();   last = cur;   return 1;  }