Changeset fd0afa23a605…
Parent 5fa9e28d34c9…
by
Changes to 8 files · Browse files at fd0afa23a605 Showing diff from parent 5fa9e28d34c9 Diff from another changeset...
|
|
@@ -0,0 +1,35 @@ + // Copyright (C) 2011 Fog Creek Software
+//
+// 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 "Kiln.h"
+#include "QueryDirstate.h"
+
+void KilnOpenRepo(const CString& strPath)
+{
+ CString strHgRoot;
+ if (GetHgRoot(strPath, strHgRoot))
+ {
+ // Try to get the default path from hgrc
+ CString strHgrcPath = strHgRoot + "\\.hg\\hgrc";
+ CString strDefaultPath;
+ LPTSTR lpszBuf = strDefaultPath.GetBuffer(MAX_PATH + 1);
+ DWORD nSize = ::GetPrivateProfileString("paths", "default", "", lpszBuf,
+ MAX_PATH, strHgrcPath);
+ strDefaultPath.ReleaseBuffer(nSize);
+ ::ShellExecute(NULL, NULL, strDefaultPath, NULL, NULL, SW_SHOW);
+ }
+}
|
|
@@ -0,0 +1,18 @@ + // Copyright (C) 2011 Fog Creek Software
+//
+// 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/>.
+
+#pragma once
+
+void KilnOpenRepo(const CString& strPath);
|
@@ -200,6 +200,41 @@ return 1;
}
+int GetHgRoot(const CString &strPath, CString& strHgRoot)
+{
+ static CQueryState qsLast;
+
+ if (strPath.IsEmpty())
+ return 0;
+
+ CQueryState qsCur;
+
+ qsCur.strPath = strPath;
+ qsCur.uTickCount = ::GetTickCount();
+
+ bool bOutdated = qsCur.uTickCount - qsLast.uTickCount > 2000;
+
+ if (!bOutdated && qsLast.strPath == strPath)
+ {
+ strHgRoot = qsLast.strHgRoot;
+ return 1;
+ }
+
+ if (::PathIsRoot(strPath))
+ {
+ qsLast = qsCur;
+ return 0;
+ }
+
+ if (FindHgRoot('0', qsCur, qsLast, bOutdated) == 0)
+ return 0;
+
+ if (qsCur.strHgRoot.IsEmpty())
+ return 0;
+
+ strHgRoot = qsCur.strHgRoot;
+ return 1;
+}
int HgQueryDirstate(char chClass, const CString& strPath, char chFilterStatus,
char& chOutStatus)
|
@@ -15,5 +15,6 @@
#pragma once
+int GetHgRoot(const CString& strPath, CString& strHgRoot);
int HgQueryDirstate(char chClass, const CString& strPath, char chFilterStatus,
char& chOutStatus);
|
@@ -206,6 +206,7 @@ <ClCompile Include="Dirstate.cpp" />
<ClCompile Include="DirstateCache.cpp" />
<ClCompile Include="IconBitmapUtils.cpp" />
+ <ClCompile Include="Kiln.cpp" />
<ClCompile Include="QueryDirstate.cpp" />
<ClCompile Include="RegistryConfig.cpp" />
<ClCompile Include="stdafx.cpp">
@@ -233,6 +234,7 @@ <ClInclude Include="Dirstate.h" />
<ClInclude Include="DirstateCache.h" />
<ClInclude Include="IconBitmapUtils.h" />
+ <ClInclude Include="Kiln.h" />
<ClInclude Include="QueryDirstate.h" />
<ClInclude Include="RegistryConfig.h" />
<ClInclude Include="resource.h" />
|
@@ -75,6 +75,9 @@ <ClCompile Include="stdafx.cpp">
<Filter>Source Files</Filter>
</ClCompile>
+ <ClCompile Include="Kiln.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="Directory.h">
@@ -137,6 +140,9 @@ <ClInclude Include="resource.h">
<Filter>Header Files</Filter>
</ClInclude>
+ <ClInclude Include="Kiln.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="THgShell.def">
|
@@ -25,6 +25,7 @@ #include "TortoiseIconBitmap.h"
#include "THgVersion.h"
#include "TortoiseHgCmenu.h"
+#include "Kiln.h"
#include <msi.h>
@@ -108,6 +109,9 @@ { "shellconf", L"Explorer Extension Settings",
L"Configures the Explorer extension.",
"settings_repo.ico", 0},
+ { "kiln", L"Kiln",
+ L"Opens the current repository in Kiln.",
+ "kiln.ico", 0 },
// Add new items here.
// Template:
@@ -119,7 +123,7 @@static const char* const RepoNoFilesMenu =
"commit status shelve vdiff sep"
" add revert rename forget remove sep"
- " workbench update grep sep"
+ " workbench update grep sep kiln sep"
" synch serve clone init thgstatus sep"
" hgignore guess sep"
" shellconf repoconf userconf sep"
@@ -136,6 +140,8 @@ " workbench sep"
" about";
+static const LPCTSTR DefaultPromotedString = "commit,workbench,kiln";
+
void CTortoiseHgCmenuBase::AddMenuList(UINT idCmd, const CString& strName)
{
ATLTRACE("AddMenuList: idCmd = %d, name = '%s'\n", idCmd, strName);
@@ -428,7 +434,7 @@
InitMenuMaps(MenuDescList, sizeof(MenuDescList) / sizeof(CMenuDescription));
- CString promoted_string = "commit,workbench"; // default value if key not found
+ CString promoted_string = DefaultPromotedString; // default value if key not found
GetRegistryConfig("PromotedItems", promoted_string);
CAtlList<CString> listPromoted;
@@ -805,6 +811,11 @@ }
return;
}
+ else if (strCmd == "kiln")
+ {
+ KilnOpenRepo(strCwd);
+ return;
+ }
if (!m_arrFiles.IsEmpty())
{
|
Loading...