Changeset e859ae81c80a…
Parent b5c317e3927b…
by
Changes to 6 files · Browse files at e859ae81c80a Showing diff from parent b5c317e3927b Diff from another changeset...
@@ -5,6 +5,7 @@ #include "Dirstatecache.h"
#include "Thgstatus.h"
#include "Winstat.h"
+#include "InitStatus.h"
#include <map>
@@ -417,6 +418,7 @@
InsertMenu(hMenu, indexMenu++, MF_SEPARATOR | MF_BYPOSITION, 0, NULL);
+ InitStatus::check();
return ResultFromShort(idCmd - idCmdFirst);
}
@@ -616,8 +618,10 @@ if (cmd == "thgstatus")
{
Thgstatus::remove(cwd);
+ InitStatus::check();
return;
}
LaunchCommand(hgcmd, cwd);
+ InitStatus::check();
}
|
|
@@ -0,0 +1,58 @@ +
+// Copyright (C) 2009 Adrian Buehlmann
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+#include "stdafx.h"
+
+#include "InitStatus.h"
+
+
+InitStatus& InitStatus::inst()
+{
+ static InitStatus s;
+ return s;
+}
+
+
+void InitStatus::add(std::string& s, const char* missing)
+{
+ if (!s.empty())
+ s += ", ";
+ s += missing;
+}
+
+
+std::string InitStatus::check()
+{
+ const InitStatus& self = inst();
+ std::string missing;
+
+ if (self.unchanged_ == 0)
+ add(missing, "unchanged");
+ if (self.added_ == 0)
+ add(missing, "added");
+ if (self.modified_ == 0)
+ add(missing, "modified");
+ if (self.notinrepo_ == 0)
+ add(missing, "notinrepo");
+
+ if (missing.empty())
+ return "";
+
+ std::string res = "InitStatus: error: uninitialized handlers: ";
+ res += missing;
+ TDEBUG_TRACE("***** " << res);
+ return res;
+}
|
|
@@ -0,0 +1,35 @@ +
+// Copyright (C) 2009 Adrian Buehlmann
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+#include <string>
+
+class InitStatus
+{
+public:
+ int unchanged_;
+ int added_;
+ int modified_;
+ int notinrepo_;
+
+ static InitStatus& inst();
+ static std::string check();
+
+private:
+ InitStatus()
+ : unchanged_(0), added_(0), modified_(0), notinrepo_(0) {}
+
+ static void add(std::string& s, const char* missing);
+};
|
@@ -5,6 +5,7 @@ Winstat.o
OBJECTS_THGSGELL = $(OBJECTS_DIRSTATE) \
+ InitStatus.o \
ContextMenu.o \
IconOverlay.o \
ShellExt.o \
|
@@ -5,6 +5,7 @@ Winstat.obj
OBJECTS_THGSGELL = $(OBJECTS_DIRSTATE) \
+ InitStatus.obj \
ContextMenu.obj \
IconOverlay.obj \
ShellExt.obj \
|
@@ -2,6 +2,7 @@ #include "ShellExt.h"
#include "TortoiseUtils.h"
#include "StringUtils.h"
+#include "InitStatus.h"
#include <olectl.h>
#define INITGUID
@@ -53,6 +54,9 @@ _UnloadResources();
}
+ if (g_cRefThisDll > 0)
+ InitStatus::check();
+
return 1;
}
@@ -76,6 +80,7 @@ CDllRegSxClassFactory *pcf =
new CDllRegSxClassFactory(TORTOISE_OLE_UNCHANGED);
TDEBUG_TRACE("DllGetClassObject clsname = " << "CLSID_TortoiseHg0");
+ ++InitStatus::inst().unchanged_;
return pcf->QueryInterface(riid, ppvOut);
}
else if (IsEqualIID(rclsid, CLSID_TortoiseHg1))
@@ -83,6 +88,7 @@ CDllRegSxClassFactory *pcf =
new CDllRegSxClassFactory(TORTOISE_OLE_ADDED);
TDEBUG_TRACE("DllGetClassObject clsname = " << "CLSID_TortoiseHg1");
+ ++InitStatus::inst().added_;
return pcf->QueryInterface(riid, ppvOut);
}
else if (IsEqualIID(rclsid, CLSID_TortoiseHg2))
@@ -90,6 +96,7 @@ CDllRegSxClassFactory *pcf =
new CDllRegSxClassFactory(TORTOISE_OLE_MODIFIED);
TDEBUG_TRACE("DllGetClassObject clsname = " << "CLSID_TortoiseHg2");
+ ++InitStatus::inst().modified_;
return pcf->QueryInterface(riid, ppvOut);
}
else if (IsEqualIID(rclsid, CLSID_TortoiseHg6))
@@ -97,6 +104,7 @@ CDllRegSxClassFactory *pcf =
new CDllRegSxClassFactory(TORTOISE_OLE_NOTINREPO);
TDEBUG_TRACE("DllGetClassObject clsname = " << "CLSID_TortoiseHg6");
+ ++InitStatus::inst().notinrepo_;
return pcf->QueryInterface(riid, ppvOut);
}
|
Loading...