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

QueryDirstate: don't read dirstate if path is a directory

For directory paths, we only need DirectoryStatus. This is especially
important if the user is looking at a directory in explorer that
has lots of repo subdirs, as we cache only 10 dirstates.

And it's faster to only read the dirstate, if the user actually
navigates into a repository.

Changeset 7c398e5c97e2

Parent 0682d7ac9234

by Adrian Buehlmann

Changes to one file · Browse files at 7c398e5c97e2 Showing diff from parent 0682d7ac9234 Diff from another changeset...

 
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
 
75
76
77
 
 
 
 
 
 
 
 
 
 
 
78
79
80
 
54
55
56
 
 
 
 
 
 
 
 
 
 
 
57
58
59
 
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
@@ -54,17 +54,6 @@
  || (relpath.size() > 4 && relpath.compare(0, 4, ".hg/") == 0))   return 0; // don't descend into .hg dir   - Dirstate* pds = Dirstatecache::get(hgroot); - if (!pds) - { - TDEBUG_TRACE("HgQueryDirstate: Dirstatecache::get(" - << hgroot << ") returns no Dirstate"); - return 0; - } - - if (filterStatus == 'A' && pds->num_added() == 0) - return 0; -   if (PathIsDirectory(path.c_str()))   {   std::auto_ptr<DirectoryStatus> pds(new DirectoryStatus()); @@ -75,6 +64,17 @@
  }   else   { + Dirstate* pds = Dirstatecache::get(hgroot); + if (!pds) + { + TDEBUG_TRACE("HgQueryDirstate: Dirstatecache::get(" + << hgroot << ") returns no Dirstate"); + return 0; + } + + if (filterStatus == 'A' && pds->num_added() == 0) + return 0; +   const Direntry* e = pds->root().get(relpath);   if (!e)   return 0;