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

shellext: move DirectoryStatus out of Dirstatecache

Changeset 27f99dea471b

Parent 00f07be142c1

by Adrian Buehlmann

Changes to one file · Browse files at 27f99dea471b Showing diff from parent 00f07be142c1 Diff from another changeset...

 
97
98
99
100
101
102
103
104
105
106
107
108
 
109
110
111
 
113
114
115
116
117
 
118
119
120
121
122
123
124
 
125
126
127
 
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
 
203
204
205
 
230
231
232
233
234
235
 
236
237
238
 
245
246
247
248
 
 
249
250
251
 
 
252
253
254
 
97
98
99
 
 
 
100
101
102
 
 
 
103
104
105
106
 
108
109
110
 
 
111
112
113
114
115
116
 
 
117
118
119
120
 
180
181
182
 
 
 
 
 
 
 
 
 
 
 
 
 
183
184
185
186
 
211
212
213
 
 
 
214
215
216
217
 
224
225
226
 
227
228
229
 
 
230
231
232
233
234
@@ -97,15 +97,10 @@
  Dirstate* dstate;   __time64_t dstate_mtime;   - DirectoryStatus* tstate; - __time64_t tstate_mtime; -   std::string hgroot;   unsigned tickcount;   - E() - : dstate(0), dstate_mtime(0), - tstate(0), tstate_mtime(0), tickcount(0) {} + E(): dstate(0), dstate_mtime(0), tickcount(0) {}   };     typedef std::list<E>::iterator Iter; @@ -113,15 +108,13 @@
  static std::list<E> _cache;    public: - static int get(const std::string& hgroot, - Dirstate*& outDirstate, DirectoryStatus*& outDirectoryStatus); + static Dirstate* get(const std::string& hgroot);  };    std::list<Dirstatecache::E> Dirstatecache::_cache;     -int Dirstatecache::get(const std::string& hgroot, - Dirstate*& outDirstate, DirectoryStatus*& outDirectoryStatus) +Dirstate* Dirstatecache::get(const std::string& hgroot)  {   Iter iter = _cache.begin();   @@ -187,19 +180,7 @@
  << _cache.size() << " repos in cache");   }   - delete iter->tstate; - iter->tstate = 0; - - { - std::auto_ptr<DirectoryStatus> pds(new DirectoryStatus()); - if (pds->read(hgroot)) - iter->tstate = pds.release(); - } - - outDirstate = iter->dstate; - outDirectoryStatus = iter->tstate; - - return 1; + return iter->dstate;  }     @@ -230,9 +211,7 @@
  || (relpath.size() > 4 && relpath.compare(0, 4, ".hg/") == 0))   return 0; // don't descend into .hg dir   - Dirstate* pds = 0; - DirectoryStatus* pts = 0; - Dirstatecache::get(hgroot, pds, pts); + Dirstate* pds = Dirstatecache::get(hgroot);   if (!pds)   {   TDEBUG_TRACE("HgQueryDirstate: Dirstatecache::get(" @@ -245,10 +224,11 @@
    if (PathIsDirectory(path.c_str()))   { - if (!pts) + std::auto_ptr<DirectoryStatus> pds(new DirectoryStatus()); + if (!pds->read(hgroot))   return 0; - - outStatus = pts->status(relpath); + + outStatus = pds->status(relpath);   }   else   {