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

shellext: ignore dirstates with unset entries

Changeset aca25c97fc27

Parent 7a7a05d6c174

by Adrian Buehlmann

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

 
100
101
102
103
104
105
106
107
108
109
110
 
111
112
 
113
 
 
 
 
 
 
 
 
 
 
114
115
116
 
100
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
@@ -100,17 +100,26 @@
  }     TDEBUG_TRACE("Dirstatecache::get: refreshing " << hgroot); - delete iter->dstate; - iter->dstate = 0;   }   else   {   TDEBUG_TRACE("Dirstatecache::get: reading " << hgroot);   }   + bool unset = false;   unsigned tc0 = GetTickCount(); - iter->dstate = Dirstate::read(path).release(); + std::auto_ptr<Dirstate> ds = Dirstate::read(path, unset);   unsigned tc1 = GetTickCount(); + + if (unset) + { + TDEBUG_TRACE("Dirstatecache::get: ignored (unset entries)"); + return iter->dstate; + } + + delete iter->dstate; + iter->dstate = ds.release(); +   unsigned delta = tc1 - tc0;   TDEBUG_TRACE("Dirstatecache::get: read done in " << delta << " ticks, "   << cache().size() << " repos in cache");
 
20
21
22
23
 
24
 
 
25
26
27
 
38
39
40
 
 
 
 
 
 
 
41
42
43
 
67
68
69
70
 
 
71
72
73
 
20
21
22
 
23
24
25
26
27
28
29
 
40
41
42
43
44
45
46
47
48
49
50
51
52
 
76
77
78
 
79
80
81
82
83
@@ -20,8 +20,10 @@
 #include "dirstate.h"     -std::auto_ptr<Dirstate> Dirstate::read(const std::string& path) +std::auto_ptr<Dirstate> Dirstate::read(const std::string& path, bool& unset)  { + unset = false; +   FILE *f = fopen(path.c_str(), "rb");   if (!f)   { @@ -38,6 +40,13 @@
  std::vector<char> relpath(MAX_PATH + 10, 0);   while (e.read(f, relpath))   { + if (e.unset()) + { + unset = true; + fclose(f); + return std::auto_ptr<Dirstate>(0); + } +   if (e.state == 'a')   ++pd->num_added_;   @@ -67,7 +76,8 @@
   void testread()  { - std::auto_ptr<Dirstate> pd = Dirstate::read(".hg/dirstate"); + bool unset; + std::auto_ptr<Dirstate> pd = Dirstate::read(".hg/dirstate", unset);   if (!pd.get()) {   printf("error: could not read .hg/dirstate\n");   return;
 
36
37
38
39
40
 
 
41
42
43
 
36
37
38
 
 
39
40
41
42
43
@@ -36,8 +36,8 @@
  char parent1[HASH_LENGTH];   char parent2[HASH_LENGTH];   - static std::auto_ptr<Dirstate> read(const std::string& path); - + static std::auto_ptr<Dirstate> read(const std::string& path, bool& unset); +   Directory& root() { return root_; }     void add(const std::string& relpath, Direntry& e) {