I wrote a litte plugin for subversion version control using TortoiseSVN. Maybe it is of use for others???
(windows only)
What do i need to compile this plugin? :(you need to build CB itself from the svn sources (you need the CB sdk)
... i put it in \share\CodeBlocks\plugins directory but i have no TortoiseSVN plugin in my plugin manager
Maybe someone can post the new sources, working with the last nightly build or explain me?Here the are - modified and working with SVN trunk.
Maybe someone can post the new sources, working with the last nightly build or explain me?Here the are - modified and working with SVN trunk.
With regards, Morten.
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_plugin_manifest_file>
<SdkVersion major="1" minor="10" release="0" />
<Plugin name="CBTortoiseSVN">
<Value title="C::B TortoiseSVN" />
<Value version="1.0" />
<Value description="C::B TortoiseSVN" />
<Value author="Jan van den Borst" />
<Value authorEmail="" />
<Value authorWebsite="http://www.codeblocks.org" />
<Value thanksTo="Code::Blocks Development Team" />
<Value license="GPL" />
</Plugin>
</CodeBlocks_plugin_manifest_file>
Ooops - you are right... Darn Copy&Paste... :-( ;-)Code<Plugin name="CBTortoiseSVN">
int ToolsPos = menuBar->FindMenu(_("&Tools"));
if ( ToolsPos == wxNOT_FOUND )
menuBar->Append(TortoiseSVN_submenu,_("TortoiseSVN"));
else
{ //menuBar->Insert(ToolsPos,TortoiseSVN_submenu,_("TortoiseSVN"));
wxMenu* pToolsMenu = menuBar->GetMenu(ToolsPos);
pToolsMenu->Append(idCBTortoiseSVN, _("TortoiseSVN"), TortoiseSVN_submenu, _("TortoiseSVN"));
}
}
//******************************************************************************
void CBTortoiseSVN::RemoveMenu(wxMenuBar *menuBar)
{
//(pecan 2006/10/04)
// It is not necessary to remove menu items and can cause a 3 to 10
// second delay durling program termination
return;
wxMenu *menu = 0;
For those who would like to append the CBTortoiseSVN menu onto the Tools menu (taking up less real estate) changing the code after the "else" will do so.
That doesn't work :S The plugin name in the manifest file is wrong :S
<Plugin name="C::B TortoiseSVN"> should be <Plugin name="CBTortoiseSVN">
but this was already told, could someone post the changed version?
?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_plugin_manifest_file>
<SdkVersion major="1" minor="10" release="0" />
<Plugin name="CBTortoiseSVN">
<Value title="C::B TortoiseSVN" />
<Value version="1.0" />
<Value description="C::B TortoiseSVN" />
<Value author="Jan van den Borst" />
<Value authorEmail="" />
<Value authorWebsite="http://www.codeblocks.org" />
<Value thanksTo="Code::Blocks Development Team" />
<Value license="GPL" />
</Plugin>
</CodeBlocks_plugin_manifest_file>
What doesn't work? This works (posted previously)This manifest file is working indeed, but ths is not in the previously posted zip file..Code?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_plugin_manifest_file>
<SdkVersion major="1" minor="10" release="0" />
<Plugin name="CBTortoiseSVN">
<Value title="C::B TortoiseSVN" />
<Value version="1.0" />
<Value description="C::B TortoiseSVN" />
<Value author="Jan van den Borst" />
<Value authorEmail="" />
<Value authorWebsite="http://www.codeblocks.org" />
<Value thanksTo="Code::Blocks Development Team" />
<Value license="GPL" />
</Plugin>
</CodeBlocks_plugin_manifest_file>
And the plugin posted previously works.
Index: CBTortoiseSVN.cpp
===================================================================
--- CBTortoiseSVN.cpp (revision 42)
+++ CBTortoiseSVN.cpp (working copy)
@@ -5,6 +5,7 @@
//* Copyright: (c) Jan van den Borst
//* License: GPL
//******************************************************************************
+#include <wx/filedlg.h>
#include "CBTortoiseSVN.h"
#include "cbeditor.h"
@@ -17,6 +18,7 @@
static int idCBTortoiseSVN = wxNewId();
static int idAdd = wxNewId();
static int idCommit = wxNewId();
+static int idCommitPath = wxNewId();
static int idDiffWithBase = wxNewId();
static int idLog = wxNewId();
static int idRepobrowser = wxNewId();
@@ -36,6 +38,7 @@
BEGIN_EVENT_TABLE(CBTortoiseSVN, cbPlugin)
EVT_MENU(idAdd, CBTortoiseSVN::OnAdd)
EVT_MENU(idCommit, CBTortoiseSVN::OnCommit)
+EVT_MENU(idCommitPath, CBTortoiseSVN::OnCommitPath)
EVT_MENU(idDiffWithBase, CBTortoiseSVN::OnDiffWithBase)
EVT_MENU(idLog, CBTortoiseSVN::OnLog)
EVT_MENU(idRepobrowser, CBTortoiseSVN::OnRepobrowser)
@@ -102,6 +105,7 @@
TortoiseSVN_submenu->Append(idDiffWithBase, _("Diff with base..."), _("Diff with base"));
TortoiseSVN_submenu->Append(idAdd, _("Add..."), _("Add"));
TortoiseSVN_submenu->Append(idCommit, _("Commit..."), _("Commit"));
+ TortoiseSVN_submenu->Append(idCommitPath, _("Commit Path..."), _("Commit Path"));
TortoiseSVN_submenu->Append(idLog, _("Log..."), _("Log"));
TortoiseSVN_submenu->Append(idRepobrowser, _("Repobrowser..."), _("Repobowser"));
TortoiseSVN_submenu->Append(idRevisiongraph, _("Revisiongraph..."), _("Revisiongraph"));
@@ -125,6 +129,11 @@
void CBTortoiseSVN::RemoveMenu(wxMenuBar *menuBar)
{
+ //(pecan 2006/10/04)
+ // It is not necessary to remove menu items and can cause a 3 to 10
+ // second delay durling program termination
+ return;
+
wxMenu *menu = 0;
wxMenuItem *item = menuBar->FindItem(idCBTortoiseSVN, &menu);
@@ -279,7 +288,43 @@
{
RunSimpleTortoiseSVNCommand(_("commit"));
}
+//******************************************************************************
+// ----------------------------------------------------------------------------
+void CBTortoiseSVN::OnCommitPath(wxCommandEvent &event) //(pecan 2006/10/05)
+// ----------------------------------------------------------------------------
+{
+ wxString filename;
+ if (!GetCurrentFilename(filename))
+ return;
+ // Ask user for path to commit
+ wxString pathName;
+ pathName = AskForPathName();
+ if ( pathName.IsEmpty() ) return;
+
+ if (!FileUnderVersionControl(pathName))
+ {
+ wxMessageBox(pathName + _("\nPath is not a working copy."), _("Info"),
+ wxOK | wxICON_INFORMATION);
+ return;
+ }
+
+ wxString command = wxT("commit");
+ wxString commandline =
+ _("TortoiseProc /command:")
+ + command
+ + _(" /path:\"")
+ + pathName
+ +_("\" /notempfile");
+
+ //-wxMessageBox( commandline,wxT("commit Project"));
+
+ DWORD exit_code;
+ if (!Run(false, false, commandline, exit_code))
+ wxMessageBox(_("Command \"") + commandline + _("\" failed"), _("Info"),
+ wxOK | wxICON_ERROR);
+}
+
//******************************************************************************
void CBTortoiseSVN::OnDiffWithBase(wxCommandEvent &event)
@@ -331,3 +376,44 @@
//******************************************************************************
// End of file
+// ----------------------------------------------------------------------------
+wxString CBTortoiseSVN::AskForFileName() //(pecan 2006/10/06)
+// ----------------------------------------------------------------------------
+{
+ wxString newFileName = wxEmptyString;
+
+ // Ask user for filename
+ wxFileDialog dlg(::wxGetTopLevelParent(0), //parent window
+ _("Select path "), //message
+ wxEmptyString, //default directory
+ wxEmptyString, //default file
+ wxT("*.*"), //wildcards
+ wxOPEN | wxFILE_MUST_EXIST ); //style
+
+ // move dialog into the parents frame space
+ wxPoint mousePosn = ::wxGetMousePosition();
+ (&dlg)->Move(mousePosn.x, mousePosn.y);
+
+ if (dlg.ShowModal() != wxID_OK) return wxEmptyString;
+ return newFileName = dlg.GetPath();
+}
+// ----------------------------------------------------------------------------
+wxString CBTortoiseSVN::AskForPathName() //(pecan 2006/10/06)
+// ----------------------------------------------------------------------------
+{
+ wxString newPathName = wxEmptyString;
+
+ // Ask user for filename
+ wxDirDialog dlg(::wxGetTopLevelParent(0), //parent window
+ _("Select path "), //message
+ ::wxGetCwd(), //default directory
+ wxDD_DEFAULT_STYLE ); //style
+
+ // move dialog into the parents frame space
+ wxPoint mousePosn = ::wxGetMousePosition();
+ (&dlg)->Move(mousePosn.x, mousePosn.y);
+
+ if (dlg.ShowModal() != wxID_OK) return wxEmptyString;
+ return newPathName = dlg.GetPath();
+}
+
Index: CBTortoiseSVN.h
===================================================================
--- CBTortoiseSVN.h (revision 41)
+++ CBTortoiseSVN.h (working copy)
@@ -47,6 +47,12 @@
void OnLock(wxCommandEvent &event);
void OnUnLock(wxCommandEvent &event);
void OnUpdateUI(wxUpdateUIEvent &event);
+
+ void OnCommitPath(wxCommandEvent &event); //(pecan 2006/10/05)
+ wxString AskForFileName(); //(pecan 2006/10/06)
+ wxString AskForPathName(); //(pecan 2006/10/06)
+
+
private:
bool FileUnderVersionControl(const wxString& filename);
bool Run(bool blocked, bool hidden, const wxString& command, DWORD& exit_code );
@@ -59,4 +65,10 @@
};
#endif // _CBTORTOISESVN_H
+// ----------------------------------------------------------------------------
+// commit 1.0.01 2006/10/6
+// Placed menu under CB Tools menu item
+// commit 1.0.02 2006/10/6
+// Added OnCommitPath menu & routine
+// ----------------------------------------------------------------------------
I know it must be useless, but can someone working on win32 post his dll AND his zip file, and also tell me if he compiled CB or used the nighlty build ?
but....
the problem is that it is written that the plugin was not loaded, saying that maybe symbols are missing.
I also have a message after this saying that the plugin might be built for a different version of the sdk...
i have the latest nightly build (revision 3023).... I don't understand anything.
If this does not work with your nightly build, then you are out of luck until the devs include it in the nightly build.[/quote
I must be unlucky because everything is the same with this new version, even with both last nightly builds.
And yes, i'm on C::B Unicode.
However, I have to thank you, Pecan, for helping me out with all that stange stuff.
So Devs !!! :D
CAN YOU INCLUDE THIS SO USEFUL TORTOISESVN PLUGIN FOR EVERYBODY IN NEXT BUILDS... :lol:
'til that time, I'll try again to find where that problem is coming from...
This plugin fully functional in latest CB SVN?