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

DirectoryStatus.cpp: do cache failed reads

Without this, read() is needlessly retried like mad when
navigating inside repos that don't have a thgstatus file
anyway.

Changeset 80264ebb8212

Parent 7c93021735af

by Adrian Buehlmann

Changes to one file · Browse files at 80264ebb8212 Showing diff from parent 7c93021735af Diff from another changeset...

 
101
102
103
 
104
105
106
 
107
108
109
 
113
114
115
116
117
 
 
 
 
 
 
 
118
119
120
121
122
123
124
125
126
 
127
128
129
 
101
102
103
104
105
106
 
107
108
109
110
 
114
115
116
 
 
117
118
119
120
121
122
123
124
 
 
 
 
 
 
 
 
125
126
127
128
@@ -101,9 +101,10 @@
 {   std::string hgroot_;   DirectoryStatus ds_; + bool readfailed_;   unsigned tickcount_;   - CacheEntry(): tickcount_(0) {}; + CacheEntry(): readfailed_(false), tickcount_(0) {};  };     @@ -113,17 +114,15 @@
    unsigned tc = GetTickCount();   - if (ce.hgroot_ == hgroot && (tc - ce.tickcount_) < 2000) - return &ce.ds_; + if (ce.hgroot_ != hgroot || (tc - ce.tickcount_) > 2000) + { + ce.hgroot_.clear(); + ce.readfailed_ = (ce.ds_.read(hgroot) == 0); + ce.hgroot_ = hgroot; + ce.tickcount_ = GetTickCount(); + }   - ce.hgroot_.clear(); - - if (ce.ds_.read(hgroot) == 0) - return 0; - - ce.hgroot_ = hgroot; - ce.tickcount_ = GetTickCount(); - return &ce.ds_; + return (ce.readfailed_ ? 0 : &ce.ds_);  }