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

shellext: call hgtk thgstatus when dirstate has unset entries

Changeset e1399fdac0d0

Parent aca25c97fc27

by Adrian Buehlmann

Changes to 3 files · Browse files at e1399fdac0d0 Showing diff from parent aca25c97fc27 Diff from another changeset...

 
20
21
22
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23
24
25
 
29
30
31
32
 
 
33
34
35
 
114
115
116
 
 
 
 
 
117
118
 
119
120
121
 
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
 
54
55
56
 
57
58
59
60
61
 
140
141
142
143
144
145
146
147
148
149
150
151
152
153
@@ -20,6 +20,31 @@
 #include "Dirstatecache.h"  #include "dirstate.h"  #include "Winstat64.h" +#include "TortoiseUtils.h" +#include "StringUtils.h" + + +void call_thgstatus(const std::string& cwd) +{ + std::string dir = GetTHgProgRoot(); + if (dir.empty()) + { + TDEBUG_TRACE("call_thgstatus: THG root is empty"); + return; + } + std::string hgcmd = dir + "\\hgtk.exe"; + + WIN32_FIND_DATAA data; + HANDLE hfind = FindFirstFileA(hgcmd.c_str(), &data); + if (hfind == INVALID_HANDLE_VALUE) + hgcmd = dir + "\\hgtk.cmd"; + else + FindClose(hfind); + + hgcmd = Quote(hgcmd) + " thgstatus --notify ."; + + LaunchCommand(hgcmd, cwd); +}      std::list<Dirstatecache::E>& Dirstatecache::cache() @@ -29,7 +54,8 @@
 }     -Dirstate* Dirstatecache::get(const std::string& hgroot) +Dirstate* Dirstatecache::get( + const std::string& hgroot, const std::string& cwd)  {   typedef std::list<E>::iterator Iter;   @@ -114,8 +140,14 @@
  if (unset)   {   TDEBUG_TRACE("Dirstatecache::get: ignored (unset entries)"); + if (!iter->unset) + { + call_thgstatus(cwd); + iter->unset = true; + }   return iter->dstate;   } + iter->unset = false;     delete iter->dstate;   iter->dstate = ds.release();
 
33
34
35
 
36
37
 
 
 
 
 
 
 
38
39
40
41
42
43
 
44
45
46
 
33
34
35
36
37
 
38
39
40
41
42
43
44
45
46
47
48
49
 
50
51
52
53
@@ -33,14 +33,21 @@
    std::string hgroot;   unsigned tickcount; + bool unset;   - E(): dstate(0), dstate_mtime(0), dstate_size(0), tickcount(0) {} + E(): + dstate(0), + dstate_mtime(0), + dstate_size(0), + tickcount(0), + unset(false) + {}   };     static std::list<E>& cache();    public: - static Dirstate* get(const std::string& hgroot); + static Dirstate* get(const std::string& hgroot, const std::string& cwd);   static void invalidate(const std::string& hgroot);  };  
 
164
165
166
167
 
168
169
170
 
164
165
166
 
167
168
169
170
@@ -164,7 +164,7 @@
  }   else   { - Dirstate* pds = Dirstatecache::get(cur.hgroot); + Dirstate* pds = Dirstatecache::get(cur.hgroot, cur.basedir);   if (!pds)   {   TDEBUG_TRACE("HgQueryDirstate: Dirstatecache::get("