Changeset cc550392c3af…
Parent 520d25731018…
by
Changes to 16 files · Browse files at cc550392c3af Showing diff from parent 520d25731018 Diff from another changeset...
@@ -529,7 +529,7 @@
InsertMenu(hMenu, indexMenu++, MF_SEPARATOR | MF_BYPOSITION, 0, NULL);
- CInitStatus::check();
+ CInitStatus::Check();
TweakMenuForVista(hMenu);
@@ -784,12 +784,12 @@
if (cmd == "thgstatus")
{
- if (CTHgStatus::remove(cwd) != 0)
+ if (CTHgStatus::Remove(cwd) != 0)
{
CString p = dir + "\\TortoiseHgOverlayServer.exe";
LaunchCommand(Quote(p), dir);
}
- CInitStatus::check();
+ CInitStatus::Check();
return;
}
@@ -825,7 +825,7 @@ }
LaunchCommand(hgcmd, cwd);
- CInitStatus::check();
+ CInitStatus::Check();
}
void CTortoiseHgCmenuBase::PrintDebugHeader(LPCITEMIDLIST pIDFolder, LPDATAOBJECT pDataObj)
|
|
|
@@ -45,7 +45,7 @@ }
-int splitbase(const CString& n, CString& base, CString& rest)
+int SplitBase(const CString& n, CString& base, CString& rest)
{
if (n.IsEmpty())
return 0;
@@ -68,7 +68,7 @@}
-int CDirectory::add(CString n, CDirentry& e)
+int CDirectory::Add(CString n, CDirentry& e)
{
CString base;
CString rest;
@@ -78,9 +78,9 @@ for (;;)
{
- if (!splitbase(n, base, rest)) {
+ if (!SplitBase(n, base, rest)) {
ATLTRACE("CDirectory('%s')::add(%d): splitbase returned 0\n",
- (LPCTSTR)path(), (LPCTSTR)n);
+ (LPCTSTR)Path(), (LPCTSTR)n);
return 0;
}
@@ -104,7 +104,7 @@
if (!d)
{
- d = new CDirectory(cur, base, cur->path());
+ d = new CDirectory(cur, base, cur->Path());
cur->subdirs_.AddTail(d);
}
@@ -114,7 +114,7 @@}
-const CDirentry* CDirectory::get(CString n) const
+const CDirentry* CDirectory::Get(CString n) const
{
CString base;
CString rest;
@@ -125,10 +125,10 @@ {
loopstart:
- if (!splitbase(n, base, rest))
+ if (!SplitBase(n, base, rest))
{
ATLTRACE("CDirectory('%s')::get(%d): splitbase returned 0\n",
- (LPCTSTR)path(), n);
+ (LPCTSTR)Path(), n);
return 0;
}
@@ -161,7 +161,7 @@}
-CDirectory* CDirectory::getdir(CString n)
+CDirectory* CDirectory::GetDir(CString n)
{
CString base;
CString rest;
@@ -172,10 +172,10 @@ {
loopstart:
- if (!splitbase(n, base, rest))
+ if (!SplitBase(n, base, rest))
{
ATLTRACE("Directory('%s')::getdir(%d): splitbase returned 0\n",
- path(), n);
+ Path(), n);
return 0;
}
@@ -201,7 +201,7 @@}
-void CDirectory::print() const
+void CDirectory::Print() const
{
POSITION position = subdirs_.GetHeadPosition();
while (position != NULL)
@@ -209,13 +209,13 @@ const CDirectory* d = subdirs_.GetNext(position);
if (!d)
{
- ATLTRACE("Directory('%s')::print: error: d is 0\n", (LPCTSTR)path());
+ ATLTRACE("Directory('%s')::print: error: d is 0\n", (LPCTSTR)Path());
return;
}
- d->print();
+ d->Print();
}
- CString base = path();
+ CString base = Path();
time_t t;
CString s;
|
@@ -33,14 +33,14 @@ CDirectory(CDirectory* p, const CString& n, const CString& basepath);
~CDirectory();
- const CString& path() const { return path_; }
+ const CString& Path() const { return path_; }
- int add(CString relpath, CDirentry& e);
+ int Add(CString relpath, CDirentry& e);
- const CDirentry* get(CString relpath) const;
- CDirectory* getdir(CString n);
+ const CDirentry* Get(CString relpath) const;
+ CDirectory* GetDir(CString n);
- void print() const;
+ void Print() const;
};
#endif
|
@@ -21,7 +21,7 @@ #include "TortoiseUtils.h"
-char CDirectoryStatus::status(CString relpath) const
+char CDirectoryStatus::Status(CString relpath) const
{
char res = 'C';
bool added = false;
@@ -56,7 +56,7 @@}
-int CDirectoryStatus::read(const CString& hgroot, const CString& cwd)
+int CDirectoryStatus::Read(const CString& hgroot, const CString& cwd)
{
v_.RemoveAll();
noicons_ = false;
@@ -68,7 +68,7 @@ {
ATLTRACE("CDirectoryStatus::read: can't open '%s'\n", p);
CString p = (cwd.GetLength() < hgroot.GetLength() ? hgroot : cwd);
- CTHgStatus::update(p);
+ CTHgStatus::Update(p);
return 0;
}
@@ -131,28 +131,28 @@}
-struct CacheEntry
+struct CCacheEntry
{
CString hgroot_;
CDirectoryStatus ds_;
bool readfailed_;
unsigned tickcount_;
- CacheEntry(): readfailed_(false), tickcount_(0) {};
+ CCacheEntry(): readfailed_(false), tickcount_(0) {};
};
-CDirectoryStatus* CDirectoryStatus::get(
+CDirectoryStatus* CDirectoryStatus::Get(
const CString& hgroot, const CString& cwd)
{
- static CacheEntry ce;
+ static CCacheEntry ce;
unsigned tc = GetTickCount();
if (ce.hgroot_ != hgroot || (tc - ce.tickcount_) > 2000)
{
ce.hgroot_.Empty();
- ce.readfailed_ = (ce.ds_.read(hgroot, cwd) == 0);
+ ce.readfailed_ = (ce.ds_.Read(hgroot, cwd) == 0);
ce.hgroot_ = hgroot;
ce.tickcount_ = GetTickCount();
}
|
@@ -28,12 +28,12 @@ bool noicons_;
public:
- CDirectoryStatus(): noicons_(false) {}
+ CDirectoryStatus() : noicons_(false) {}
- static CDirectoryStatus* get(const CString& hgroot, const CString& cwd);
- char status(CString relpath) const;
- bool noicons() const { return noicons_; }
+ static CDirectoryStatus* Get(const CString& hgroot, const CString& cwd);
+ char Status(CString relpath) const;
+ bool NoIcons() const { return noicons_; }
private:
- int read(const CString& hgroot, const CString& cwd);
+ int Read(const CString& hgroot, const CString& cwd);
};
|
@@ -21,7 +21,7 @@ #include "Winstat.h"
-int CDirentry::read(FILE* f, CString& relpath)
+int CDirentry::Read(FILE* f, CString& relpath)
{
if (fread(&state, sizeof(state), 1, f) != 1)
return 0;
@@ -48,7 +48,7 @@}
-char CDirentry::status(const CWinstat& stat) const
+char CDirentry::Status(const CWinstat& stat) const
{
switch (this->state)
{
|
@@ -35,10 +35,10 @@
CString name;
- int read(FILE* f, CString& relpath);
- char status(const CWinstat& stat) const;
+ int Read(FILE* f, CString& relpath);
+ char Status(const CWinstat& stat) const;
- bool unset() const {
+ bool Unset() const {
return (state == 'n') && (mode == 0) && (size == -1) && (mtime == -1);
}
|
|
|
@@ -22,25 +22,25 @@ #include "Thgstatus.h"
#include "Winstat.h"
-CAtlList<CDirstateCache::CEntry>& CDirstateCache::cache()
+CAtlList<CDirstateCache::CEntry>& CDirstateCache::Cache()
{
static CAtlList<CDirstateCache::CEntry> c;
return c;
}
-CDirstate* CDirstateCache::get(const CString& hgroot, const CString& cwd,
+CDirstate* CDirstateCache::Get(const CString& hgroot, const CString& cwd,
bool& unset, bool usekbfiles)
{
unset = false;
- POSITION position = cache().GetHeadPosition();
+ POSITION position = Cache().GetHeadPosition();
while (position != NULL)
{
- CEntry& rItem = cache().GetAt(position);
+ CEntry& rItem = Cache().GetAt(position);
if (hgroot == rItem.hgroot && usekbfiles == rItem.usekbfiles)
break;
- cache().GetNext(position);
+ Cache().GetNext(position);
}
CWinstat stat;
@@ -60,9 +60,9 @@ ATLTRACE("CDirstateCache::get: lstat('%s') ok\n", (LPCTSTR)path);
new_stat = true;
- if (cache().GetCount() >= 10)
+ if (Cache().GetCount() >= 10)
{
- CEntry e = cache().RemoveTail();
+ CEntry e = Cache().RemoveTail();
ATLTRACE("CDirstateCache::get: dropping '%s'\n", (LPCTSTR)e.hgroot);
delete e.dstate;
}
@@ -71,11 +71,11 @@ e.hgroot = hgroot;
e.usekbfiles = usekbfiles;
e.tickcount = tc;
- cache().AddHead(e);
- position = cache().GetHeadPosition();
+ Cache().AddHead(e);
+ position = Cache().GetHeadPosition();
}
- CEntry& rItem = cache().GetAt(position);
+ CEntry& rItem = Cache().GetAt(position);
if (!new_stat && tc - rItem.tickcount > 500)
{
if (0 != stat.lstat(path, true))
@@ -83,7 +83,7 @@ ATLTRACE("CDirstateCache::get: lstat('%s') failed\n", (LPCTSTR)path);
ATLTRACE("CDirstateCache::get: dropping '%s'\n", (LPCTSTR)rItem.hgroot);
delete rItem.dstate;
- cache().RemoveAt(position);
+ Cache().RemoveAt(position);
return 0;
}
rItem.tickcount = tc;
@@ -113,7 +113,7 @@
unset = false;
unsigned tc0 = GetTickCount();
- CAutoPtr<CDirstate> ds = CDirstate::read(path, unset);
+ CAutoPtr<CDirstate> ds = CDirstate::Read(path, unset);
unsigned tc1 = GetTickCount();
bool request_thgstatus_update = true;
@@ -138,7 +138,7 @@
unsigned delta = tc1 - tc0;
ATLTRACE("CDirstateCache::get: read done in %d ticks, %d repos in cache\n",
- delta, cache().GetCount());
+ delta, Cache().GetCount());
rItem.dstate_mtime = stat.mtime;
rItem.dstate_size = stat.size;
@@ -146,7 +146,7 @@ if (request_thgstatus_update)
{
ATLTRACE("CDirstateCache::get: calling Thgstatus::update\n");
- CTHgStatus::update(cwd);
+ CTHgStatus::Update(cwd);
}
else
{
@@ -157,19 +157,19 @@}
-void CDirstateCache::invalidate(const CString& hgroot, bool usekbfiles)
+void CDirstateCache::Invalidate(const CString& hgroot, bool usekbfiles)
{
if (hgroot.IsEmpty())
return;
- POSITION position = cache().GetHeadPosition();
+ POSITION position = Cache().GetHeadPosition();
while (position != NULL)
{
- CEntry& rItem = cache().GetAt(position);
+ CEntry& rItem = Cache().GetAt(position);
if (hgroot == rItem.hgroot && usekbfiles == rItem.usekbfiles)
{
delete rItem.dstate;
- cache().RemoveAt(position);
+ Cache().RemoveAt(position);
ATLTRACE("Dirstatecache::invalidate('%s')\n", (LPCTSTR)hgroot);
break;
}
|
@@ -43,12 +43,12 @@ {}
};
- static CAtlList<CEntry>& cache();
+ static CAtlList<CEntry>& Cache();
public:
- static CDirstate* get(const CString& hgroot, const CString& cwd, bool& unset,
+ static CDirstate* Get(const CString& hgroot, const CString& cwd, bool& unset,
bool usekbfiles = false);
- static void invalidate(const CString& hgroot, bool usekbfiles = false);
+ static void Invalidate(const CString& hgroot, bool usekbfiles = false);
};
#endif
|
@@ -20,14 +20,14 @@ #include "Thgstatus.h"
-CInitStatus& CInitStatus::inst()
+CInitStatus& CInitStatus::Inst()
{
static CInitStatus s;
return s;
}
-void CInitStatus::add(CString& s, const char* missing)
+void CInitStatus::Add(CString& s, const char* missing)
{
if (!s.IsEmpty())
s += ", ";
@@ -35,25 +35,25 @@}
-CString CInitStatus::check()
+CString CInitStatus::Check()
{
- const CInitStatus& self = inst();
+ const CInitStatus& self = Inst();
CString missing;
if (self.unchanged_ == 0)
- add(missing, "unchanged");
+ Add(missing, "unchanged");
if (self.added_ == 0)
- add(missing, "added");
+ Add(missing, "added");
if (self.modified_ == 0)
- add(missing, "modified");
+ Add(missing, "modified");
if (self.notinrepo_ == 0)
- add(missing, "notinrepo");
+ Add(missing, "notinrepo");
if (missing.IsEmpty())
return "";
CString reason = "uninitialized handlers: " + missing;
- CTHgStatus::error(reason);
+ CTHgStatus::Error(reason);
CString res = "InitStatus: error: " + reason;
ATLTRACE("***** %s\n", (LPCTSTR)res);
return res;
|
@@ -22,12 +22,12 @@ int modified_;
int notinrepo_;
- static CInitStatus& inst();
- static CString check();
+ static CInitStatus& Inst();
+ static CString Check();
private:
CInitStatus() :
unchanged_(0), added_(0), modified_(0), notinrepo_(0) {}
- static void add(CString& s, const char* missing);
+ static void Add(CString& s, const char* missing);
};
|
|
|
@@ -148,7 +148,7 @@ if (ticks > 5000 /* ms */)
{
CString reason = "ignoring slow \"" + p + "\"";
- CTHgStatus::error(reason);
+ CTHgStatus::Error(reason);
file_access_is_unacceptably_slow = true;
goto exit;
}
@@ -258,8 +258,8 @@ relpath.SetAt(i, '/');
}
- CDirectoryStatus* pdirsta = CDirectoryStatus::get(cur.hgroot, cur.basedir);
- if (pdirsta && pdirsta->noicons())
+ CDirectoryStatus* pdirsta = CDirectoryStatus::Get(cur.hgroot, cur.basedir);
+ if (pdirsta && pdirsta->NoIcons())
{
last = cur;
return 0;
@@ -267,7 +267,7 @@
if (relpath.IsEmpty())
{
- outStatus = (pdirsta ? pdirsta->status(relpath) : '?');
+ outStatus = (pdirsta ? pdirsta->Status(relpath) : '?');
cur.status = outStatus;
cur.tickcount = ::GetTickCount();
last = cur;
@@ -276,10 +276,10 @@
bool unset = false;
- CDirstate* pds = CDirstateCache::get(cur.hgroot, cur.basedir, unset);
+ CDirstate* pds = CDirstateCache::Get(cur.hgroot, cur.basedir, unset);
if (!pds)
{
- ATLTRACE("%s Dirstatecache::get('%s') returns no Dirstate\n", (LPCTSTR)dp,
+ ATLTRACE("%s Dirstatecache::Get('%s') returns no Dirstate\n", (LPCTSTR)dp,
(LPCTSTR)cur.hgroot);
last = cur;
return 0;
@@ -300,32 +300,32 @@
if (cur.isdir)
{
- if (!relpath.IsEmpty() && !pds->root().getdir(relpath))
+ if (!relpath.IsEmpty() && !pds->Root().GetDir(relpath))
{
// attempt to get status from kbfiles
- pds = CDirstateCache::get(cur.hgroot, cur.basedir, unset, true);
- if (!pds || !pds->root().getdir(relpath))
+ pds = CDirstateCache::Get(cur.hgroot, cur.basedir, unset, true);
+ if (!pds || !pds->Root().GetDir(relpath))
{
last = cur;
return 0; // unknown dir -> no icon
}
}
- outStatus = (pdirsta ? pdirsta->status(relpath) : '?');
+ outStatus = (pdirsta ? pdirsta->Status(relpath) : '?');
cur.status = outStatus;
cur.tickcount = ::GetTickCount();
last = cur;
return 1;
}
- const CDirentry* e = pds->root().get(relpath);
+ const CDirentry* e = pds->Root().Get(relpath);
if (!e)
{
// attempt to get status from kbfiles
- pds = CDirstateCache::get(cur.hgroot, cur.basedir, unset, true);
+ pds = CDirstateCache::Get(cur.hgroot, cur.basedir, unset, true);
if (pds)
{
- e = pds->root().get(relpath);
+ e = pds->Root().Get(relpath);
}
if (!e)
{
@@ -334,7 +334,7 @@ }
}
- outStatus = e->status(stat);
+ outStatus = e->Status(stat);
if (unset)
goto exit;
@@ -348,7 +348,7 @@ {
ATLTRACE("%s relbase = '%s'\n", (LPCTSTR)dp, (LPCTSTR)relbase);
- char basedir_status = pdirsta->status(relbase);
+ char basedir_status = pdirsta->Status(relbase);
ATLTRACE("%s basedir_status = '%c'\n", (LPCTSTR)dp, basedir_status);
if (basedir_status != 'M')
@@ -373,8 +373,8 @@
if (update)
{
- ATLTRACE("%s calling Thgstatus::update\n", (LPCTSTR)dp);
- CTHgStatus::update(path);
+ ATLTRACE("%s calling Thgstatus::Update\n", (LPCTSTR)dp);
+ CTHgStatus::Update(path);
}
exit:
|
@@ -22,16 +22,16 @@ static int SendRequest(const CString& request);
public:
- static int update(const CString& path) {
+ static int Update(const CString& path) {
return SendRequest("update|" + path);
}
- static int remove(const CString& path) {
+ static int Remove(const CString& path) {
return SendRequest("remove|" + path);
}
- static int error(const CString& text) {
+ static int Error(const CString& text) {
return SendRequest("error|" + text);
}
- static int terminate() {
+ static int Terminate() {
return SendRequest("terminate|");
}
};
|
@@ -21,7 +21,7 @@ #include "TortoiseUtils.h"
-CAutoPtr<CDirstate> CDirstate::read(const CString& path, bool& unset)
+CAutoPtr<CDirstate> CDirstate::Read(const CString& path, bool& unset)
{
unset = false;
@@ -39,15 +39,15 @@
CDirentry e;
CString relpath;
- while (e.read(f, relpath))
+ while (e.Read(f, relpath))
{
- if (e.unset())
+ if (e.Unset())
unset = true;
if (e.state == 'a')
++pd->num_added_;
- pd->add(relpath, e);
+ pd->Add(relpath, e);
}
fclose(f);
@@ -56,7 +56,7 @@}
-static char *revhash_string(const char revhash[HASH_LENGTH])
+static char *RevHashString(const char revhash[HASH_LENGTH])
{
unsigned ix;
static char rev_string[HASH_LENGTH * 2 + 1];
@@ -71,26 +71,26 @@}
-void testread()
+void TestRead()
{
bool unset;
- CAutoPtr<CDirstate> pd = CDirstate::read(".hg/dirstate", unset);
+ CAutoPtr<CDirstate> pd = CDirstate::Read(".hg/dirstate", unset);
if ((CDirstate*)pd == NULL) {
printf("error: could not read .hg/dirstate\n");
return;
}
- printf("parent1: %s\n", revhash_string(pd->parent1));
- printf("parent2: %s\n", revhash_string(pd->parent2));
- printf("entries: %d\n\n", pd->size());
+ printf("parent1: %s\n", RevHashString(pd->parent1));
+ printf("parent2: %s\n", RevHashString(pd->parent2));
+ printf("entries: %d\n\n", pd->Size());
- pd->root().print();
+ pd->Root().Print();
}
#ifdef APPMAIN
int main(int argc, char *argv[])
{
- testread();
+ TestRead();
return 0;
}
#endif
|
@@ -33,17 +33,17 @@ char parent1[HASH_LENGTH];
char parent2[HASH_LENGTH];
- static CAutoPtr<CDirstate> read(const CString& path, bool& unset);
+ static CAutoPtr<CDirstate> Read(const CString& path, bool& unset);
- CDirectory& root() { return root_; }
+ CDirectory& Root() { return root_; }
- void add(const CString& relpath, CDirentry& e) {
- root_.add(relpath, e);
+ void Add(const CString& relpath, CDirentry& e) {
+ root_.Add(relpath, e);
++num_entries_;
}
- unsigned num_added() const { return num_added_; }
- unsigned size() const { return num_entries_; }
+ unsigned NumAdded() const { return num_added_; }
+ unsigned Size() const { return num_entries_; }
private:
CDirstate() :
|
@@ -6,7 +6,7 @@
extern "C" UINT __stdcall TerminateIconServer()
{
- if (CTHgStatus::terminate() == 0)
+ if (CTHgStatus::Terminate() == 0)
{
// pipe ok, so icon server is running
// -> wait a bit for icon server to shut down
|
Loading...