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

shellext: check DirectoryStatus if modified file encountered

update thgstatus if needed

Changeset 9767c36b5bfd

Parent 380652f787c7

by Adrian Buehlmann

Changes to one file · Browse files at 9767c36b5bfd Showing diff from parent 380652f787c7 Diff from another changeset...

 
23
24
25
 
26
27
28
 
100
101
102
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
103
104
105
 
194
195
196
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
197
198
199
 
23
24
25
26
27
28
29
 
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
 
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
@@ -23,6 +23,7 @@
 #include "Dirstatecache.h"  #include "Winstat.h"  #include "TortoiseUtils.h" +#include "Thgstatus.h"    #include <shlwapi.h>   @@ -100,6 +101,29 @@
 }     +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)  { @@ -194,6 +218,29 @@
  }     outStatus = e->status(stat); + + if (outStatus == 'M') + { + DirectoryStatus* dirsst = DirectoryStatus::get(cur.hgroot); + 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;