Developer forums (C::B DEVELOPMENT STRICTLY!) > Plugins development

TortoiseSVN plugin

<< < (5/7) > >>

Pecan:
For those who would like to commit a complete folder/directory rather than just a single file, the following patch will do so.


--- Code: ---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
+// ----------------------------------------------------------------------------
 


--- End code ---

This is a very nice plugin. I think it's gonna get a lot of use. Could we add it to the contribs?

orel:
No luck....

I definitely can't make CBTortoiseSVN work. I even tried 'the voodoo way' (i.e trying to recopy the same zip on itself).

Did you guys have compile CB by yourselves or are you using nightly builds.  I am using nightly builds, do you think this may have an influence on the plugin ?

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 ?

That would be really nice... :D

I am using CB and Tortoise everyday, so it would be really stupid not to have them embedded each other...

Pecan:

--- Quote from: orel on October 07, 2006, 01:33:22 am ---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 ?

--- End quote ---

Ok, the following url points to CBTortoiseSVN.zip on SaveFile.com.
It contains both the debug and release versions of the dll along with the code and mainifest built with SVN 3001.

Note: this version has been modified to allow commits from a path, and places the menu as a submenu under Tools.

http://savefile.com/files/136874

orel:
Thank you very much Pecan, very kind of you

but....

I just put the dll and the zip file where they must be.

And this time, there is an improvement :

I have something written about the plugin in the debug log :

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...

This is the same with the debug and release version of the plugin

i have the latest nightly build (revision 3023).... I don't understand anything.

Pecan:

--- Quote from: orel on October 07, 2006, 12:22:03 pm ---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.

--- End quote ---

Ok. Hold on. I'll update and re-compile. I'll post a message when it's done.

Edit: Here is a url for CBTortoise.zip build from SVN 3029 containing code, debug and release .dll's along with the manifest & manifest in a CBTortoiseSVN.zip file.

If this does not work with your nightly build, then you are out of luck until the devs include it in the nightly build.

Secondly, I do not understand why it does not work with your nightly unless you are using the Ansi build. This is a Unicode build. It will not work with the Ansi.

http://savefile.com/files/138509

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version