Author Topic: SVNInside : development of another SVN plugin for CodeBlocks  (Read 140354 times)

Offline orel

  • Multiple posting newcomer
  • *
  • Posts: 96
SVNInside : development of another SVN plugin for CodeBlocks
« on: October 08, 2007, 11:31:10 pm »
Hi everybody,

I am currently developping a CB plugin integrating svn version control to the CB environment. I already looked after the good work made in CBTortoiseSVN but i would like more control inside Codeblocks. I feel relatively limited about the obligation to use TortoiseSVN for everything, and adding svn AND TortoiseSVN would make one plugin to have too many dependencies, and redondancies between them.

I could have linked my plugin with the svn library only but i chose a third option because of the complexity of this library, and found an easy way to achieve that :
          by using svn command line and parsing its output to get infos about the success or the failure of the command.

 I don't claim that is the best way to achieve this but it's an easy way to get a good control inside Codeblocks. Futhermore, svn command line output is cleverly made to be parsed very easily(this solution is often used to make batch operations on a repository or a working copy with Perl scripts or other script languages).

You can get the last source code on svn at : http://tools.assembla.com/svn/SVNInside


[This list will be updated when major additions/modifications are made]

For the moment , SVNInside features are :
 
  • a new tab in the project management notebook, containing a tree with the project files status
  • a configuration dialog where you can set properties like login, password, svn path, etc. This tree is the nervous center of SVNInside, by right clicking you get a popup menu to do things like commit, revert, add files to the repository, lock-unlock files, etc... depending of their status
  • a short addition to the codeblocks projects extensions node managed by SVNInside



Here is a screenshot of the new project management tab : the SVNInside tree



And i have a question to ask : i am trying to implement a way to block modifications on a file locked by another person. My wish is to add a msgbox when the cbEVT_EDITOR_MODIFIED event is sent that kind of file, asking for the user to choose among two options :
  • continue modyfing the file locally as if it wasn't locked, despite the fact that it won't be able to be commited until it is unlocked
  • revert the modification which generated the event and wait until the file it is unlocked

For the second option, i can't manage to undo the action just after the messazge box has been closed, i tried different ways :

Code: [Select]
cbStyledTextCtrl* pControl = pEditor->GetControl();
if (pControl)
{
     //pControl->BeginUndoAction();    with those 2 lines commented or not
     pControl->Undo();
     //pControl->EndUndoAction();
}

And i tried this:
Code: [Select]
EditorBase* ed = Manager::Get()->GetEditorManager()->GetActiveEditor();
if (ed) ed->Undo();

with no success, can someone help me about that ?
I must add that this project is currently under development and i would be happy to share my sources with anybody, to get feedback with my programming, my understanding of the wxWidgets or Code::Blocks APIs.

PS : sorry about my english if somethings appear obscure...
« Last Edit: October 15, 2007, 12:49:16 am by orel »
windows XP SP2
mingw gcc 3.4.5
svn Code::Blocks and M$ Visual Studio 2005 and .NET to eat!! SVNInside plugin :http://forums.codeblocks.org/index.php/topic,7063.0.html

Offline Jan van den Borst

  • Multiple posting newcomer
  • *
  • Posts: 99
Re: SVNInside : development of another SVN plugin for CodeBlocks
« Reply #1 on: October 08, 2007, 11:47:11 pm »
The new tab looks great.
Maybe we should join forces and make a svn plugin that is also working in non msw environments?

Jan vd Borst

Offline orel

  • Multiple posting newcomer
  • *
  • Posts: 96
Re: SVNInside : development of another SVN plugin for CodeBlocks
« Reply #2 on: October 08, 2007, 11:58:49 pm »
What a good idea!!

Porting this plugin to other platforms should not be very difficult, c++ stl is used when possible and all code is portable, the only part of it which is non portable for the moment is the class i implement to read console output (under Win32 that's not an easy task). I think reading svn console output under linux (or any other platform) should be easier.

If you are interested i can email you the sources.

I could have posted them on this forum but SVNInside is for the moment under development, working but too many features lack to be used daily.
windows XP SP2
mingw gcc 3.4.5
svn Code::Blocks and M$ Visual Studio 2005 and .NET to eat!! SVNInside plugin :http://forums.codeblocks.org/index.php/topic,7063.0.html

Offline orel

  • Multiple posting newcomer
  • *
  • Posts: 96
Re: SVNInside : development of another SVN plugin for CodeBlocks
« Reply #3 on: October 09, 2007, 12:05:49 am »
Your last post made me realize that i totally forgotten to tell for which platform SVNInside is currently developped, for win32 yes but :

under Windows XP
with CodeBlocks revision 4503
on a Penitum Centrino DUO
windows XP SP2
mingw gcc 3.4.5
svn Code::Blocks and M$ Visual Studio 2005 and .NET to eat!! SVNInside plugin :http://forums.codeblocks.org/index.php/topic,7063.0.html

Offline Jan van den Borst

  • Multiple posting newcomer
  • *
  • Posts: 99
Re: SVNInside : development of another SVN plugin for CodeBlocks
« Reply #4 on: October 09, 2007, 12:09:34 am »
Couldn't you setup a svn repository as I did on assembla?
Jan

(I use a laptop vista, celeron, latest codeblocks from svn)

Offline orel

  • Multiple posting newcomer
  • *
  • Posts: 96
Re: SVNInside : development of another SVN plugin for CodeBlocks
« Reply #5 on: October 09, 2007, 12:22:38 am »
I didn't know about that good option, better using svn to develop a svn plugin :D

Let me deploy my sources on it and i will post you the link here, as soon as possible (probably tomorrow because bed time is coming...) but who knows ?
windows XP SP2
mingw gcc 3.4.5
svn Code::Blocks and M$ Visual Studio 2005 and .NET to eat!! SVNInside plugin :http://forums.codeblocks.org/index.php/topic,7063.0.html

Offline orel

  • Multiple posting newcomer
  • *
  • Posts: 96
Re: SVNInside : development of another SVN plugin for CodeBlocks
« Reply #6 on: October 09, 2007, 02:16:07 am »
     for Jan van den Borst:

Done !! you can go and get the source code at http://tools.assembla.com/svn/SVNInside. Thank you for your interest !

     for others:

You should't download and build this plugin if your goal is to use it, for the moment. It is only the beggining of its development, so there are a lot of bugs, a lot of test code here and there, etc.

orel
windows XP SP2
mingw gcc 3.4.5
svn Code::Blocks and M$ Visual Studio 2005 and .NET to eat!! SVNInside plugin :http://forums.codeblocks.org/index.php/topic,7063.0.html

Offline Jan van den Borst

  • Multiple posting newcomer
  • *
  • Posts: 99
Re: SVNInside : development of another SVN plugin for CodeBlocks
« Reply #7 on: October 09, 2007, 11:08:36 am »
OK I will look at this tonight.

ps I'm in the GMT+1 timezone (amsterdam, netherlands)

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9496
Re: SVNInside : development of another SVN plugin for CodeBlocks
« Reply #8 on: October 09, 2007, 12:01:37 pm »
Done !! you can go and get the source code at http://tools.assembla.com/svn/SVNInside.
Nice work! The screenshot looks pretty nice, really! I am currently trying to compile. ;-) Hence I have two questions so far:
1.) Why don't you provide the project files?! You stated in the log it's not needed, but why?!
2.) CSVNcommand.h and CSVNCommand.cpp differ in their case. While this doesn't matter on Windows it might be an ugly thing on Linux.
With regards, Morten.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: http://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: http://wiki.codeblocks.org/index.php?title=FAQ

Offline manmach

  • Multiple posting newcomer
  • *
  • Posts: 39
Re: SVNInside : development of another SVN plugin for CodeBlocks
« Reply #9 on: October 09, 2007, 01:34:59 pm »
I was wondering, why the new tab? My thinking is it would be nicer if the project files listed under the Projects tab would be marked as under revision control or not. And right clicking one would then allow you to manipulate them.

Although the inability to select more than one file on the Projects tab, would make batch operations impossible.

Offline JGM

  • Lives here!
  • ****
  • Posts: 518
  • Got to practice :)
Re: SVNInside : development of another SVN plugin for CodeBlocks
« Reply #10 on: October 09, 2007, 02:36:09 pm »
Great job!  :D

the only part of it which is non portable for the moment is the class i implement to read console output (under Win32 that's not an easy task). I think reading svn console output under linux (or any other platform) should be easier.

You can use a wxWidgets function named wxExecute to execute and read the output of console programs like you said. In that way you don't have to worry about making different code for different platforms.

Quote from: wxWidgets Documentation
long wxExecute(const wxString& command, wxArrayString& output, int flags = 0)


Offline Jan van den Borst

  • Multiple posting newcomer
  • *
  • Posts: 99
Re: SVNInside : development of another SVN plugin for CodeBlocks
« Reply #11 on: October 09, 2007, 08:34:55 pm »
Done !! you can go and get the source code at http://tools.assembla.com/svn/SVNInside.
Nice work! The screenshot looks pretty nice, really! I am currently trying to compile. ;-) Hence I have two questions so far:
1.) Why don't you provide the project files?! You stated in the log it's not needed, but why?!
Can you provide the project file?

Offline killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5177
Re: SVNInside : development of another SVN plugin for CodeBlocks
« Reply #12 on: October 09, 2007, 09:22:31 pm »
yes; using wxExecute will be better.
I used that one to for my ClearCase and valgrind plug-ins.

Once CB 1.0 is out, we gonna try to create a common interface for version control system in CB (like M$ does).


Since you are calling the command line svn, wxExecute should be fine for the job.

Offline orel

  • Multiple posting newcomer
  • *
  • Posts: 96
Re: SVNInside : development of another SVN plugin for CodeBlocks
« Reply #13 on: October 09, 2007, 09:44:51 pm »

First of all, thank you for compliments about this plugin.

Done !! you can go and get the source code at http://tools.assembla.com/svn/SVNInside.
Nice work! The screenshot looks pretty nice, really! I am currently trying to compile. ;-) Hence I have two questions so far:
1.) Why don't you provide the project files?! You stated in the log it's not needed, but why?!
Can you provide the project file?

Done !

I added it and also a little windows batch file here to zip and copy files where they are needed to debug the plugin dll.

1.) Why don't you provide the project files?! You stated in the log it's not needed, but why?!

i didn't provide it because i thought it was too messy and too personalized to be useful for others, but you're right : better modifying an existent one, even messy, rather than creating a new one from scratch.

2.) CSVNcommand.h and CSVNCommand.cpp differ in their case. While this doesn't matter on Windows it might be an ugly thing on Linux.
With regards, Morten.

This is also done!

Great job!  :D
You can use a wxWidgets function named wxExecute to execute and read the output of console programs like you said. In that way you don't have to worry about making different code for different platforms.

Than you for this hint, didn't knew about that, i'm currently trying to implement it and looking after other 'only windows code', but there is not too much.

Did someone already looked after the code, can you compile and run it under linux or even windows? Please tell me if you encounter some problems.

And i have to reask that question, because i found no answer for the moment, how to undo a file modification after having handled cb_EDITOR_MODIFIED_EVENT?
windows XP SP2
mingw gcc 3.4.5
svn Code::Blocks and M$ Visual Studio 2005 and .NET to eat!! SVNInside plugin :http://forums.codeblocks.org/index.php/topic,7063.0.html

Offline darthdespotism

  • Almost regular
  • **
  • Posts: 163
    • Coder's Nemesis
Re: SVNInside : development of another SVN plugin for CodeBlocks
« Reply #14 on: October 09, 2007, 11:15:16 pm »
I'll try some Linux builds as soon as you think it'll help ;) but as I never worked with wxWidgets as a Programmer I can't help you with that right away