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

dirstate.cpp: use iterator over dirstate entries

Changeset 0bb05c596bae

Parent 8e6c2ef3d883

by Adrian Buehlmann

Changes to one file · Browse files at 0bb05c596bae Showing diff from parent 8e6c2ef3d883 Diff from another changeset...

 
86
87
88
 
 
89
90
91
 
272
273
274
275
 
 
276
277
 
278
279
280
 
334
335
336
337
 
 
338
339
 
 
 
340
341
342
 
343
344
345
 
86
87
88
89
90
91
92
93
 
274
275
276
 
277
278
279
 
280
281
282
283
 
337
338
339
 
340
341
342
 
343
344
345
346
347
 
348
349
350
351
@@ -86,6 +86,8 @@
  char parent2[HASH_LENGTH];     std::vector<direntry> entries; + + typedef std::vector<direntry>::const_iterator Iter;     static std::auto_ptr<dirstate> read(const char *path);   void add(const direntry& e) { entries.push_back(e); } @@ -272,9 +274,10 @@
  size_t rootlen = strlen(hgroot);   size_t len = relpath.size();   - for (unsigned ix = 0; ix < pd->entries.size() && !modified; ix++) + for (dirstate::Iter iter = pd->entries.begin(); + iter != pd->entries.end() && !modified; ++iter)   { - const direntry& e = pd->entries[ix]; + const direntry& e = *iter;     if (e.name.compare(0, len, relpath) != 0)   continue; @@ -334,12 +337,15 @@
  TDEBUG_TRACE("HgQueryDirstateFile: pd->entries.size() = " << pd->entries.size());   TDEBUG_TRACE("HgQueryDirstateFile: relpath = " << relpath);   - for (unsigned ix = 0; ix < pd->entries.size(); ix++) + for (dirstate::Iter iter = pd->entries.begin(); + iter != pd->entries.end(); ++iter)   { - if (relpath == pd->entries[ix].name) + const direntry& e = *iter; + + if (relpath == e.name)   {   TDEBUG_TRACE("HgQueryDirstateFile: found relpath"); - outStatus = mapdirstate(pd->entries[ix], stat); + outStatus = mapdirstate(e, stat);   TDEBUG_TRACE("HgQueryDirstateFile: outStatus = " << outStatus);   return outStatus != '?';   }