News:

When registered with our forums, feel free to send a "here I am" post here to differ human beings from SPAM bots.

Main Menu

Version control plug-in

Started by dushara, November 20, 2010, 04:55:21 AM

Previous topic - Next topic

dushara

Hi all,

I'm working on a version control plug-in (git) but have hit a small hurdle. How do I work out the project file path? I went through some of the header files (cbproject.h etc), but I can't see an obvious way. I need it for 2 reasons.

1. In order to check-in the project file itself to the repo.
2. git seems to require the CWD to be within the directory where .git exists.

Thanks in advance.
D

oBFusCATed


virtual wxString GetBasePath() const; ///< Read the target's base path, e.g. if GetFilename() returns "/usr/local/bin/xxx", base path will return "/usr/local/bin"

Have you tried this method?
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

dushara

Quote from: oBFusCATed on November 20, 2010, 11:04:25 AM

virtual wxString GetBasePath() const; ///< Read the target's base path, e.g. if GetFilename() returns "/usr/local/bin/xxx", base path will return "/usr/local/bin"

Have you tried this method?

No I didn't see that. Thanks.

D

cacb

Quote from: dushara on November 20, 2010, 04:55:21 AM
Hi all,

I'm working on a version control plug-in (git) ....

That is interesting, I have been missing some way to use version control from within Code::Blocks. I hope your plugin will be general enough to support also other version control systems than git? For example, I prefer Bazaar with the QBZR gui front end, as it offers the same functionality on Windows and Linux.

Perhaps this can serve as inspiration to your work: Without a proper plugin for this purpose, I have used the Code::Blocks Tools menu to make a "plugin" supporting QBZR version control. The result is a Code::Blocks Tools menu looking like this (on Linux):



The definition of the tools are stored in the Code::Blocks default.config file. As I use several machines, I had to figure out a way to move the definitions from one machine to the other, i.e. edit the .config file manually. This is described in the link below
http://arnholm.org/cpde/codeblocks/CB_tools_menu.zip

So far it seems to work, but it could be more elegant. Perhaps your plugin is the answer. But in fact a slight improvement to the Tools menu facility would almost seem good enough
- Some way to define a submenu in the Tools menu
- Some way to export/import submenus to/from XML files, allowing for definitions to be moved to other machines.

This way, one could have a for example cb_tools_qbzr.xml file containing definitions for QBZR version control commands that would be installed as a submenu under Tools. Or even better, do something similar with your source control plugin. I am guessing you need to save some configuration data, so quite possibly similar requirements apply.

Looking forward to hear about your progress with this plugin!

oBFusCATed

Quote from: cacb on November 21, 2010, 11:31:32 AM
- Some way to export/import submenus to/from XML files, allowing for definitions to be moved to other machines.
Have you tried cb_share_config? It comes with the C::B's installation.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

cacb

Quote from: oBFusCATed on November 21, 2010, 11:51:09 AM
Have you tried cb_share_config? It comes with the C::B's installation.

No, I wasn't aware of it, thanks! I checked it now and find it is available on both my windows and linux installations. Nice tool!

However, as far as i can tell it will copy ALL of the tools definitions from one config file to another, and that will not work for the case I described where some of the tools are platform specific (e.g. the external debugger tools in my example), and some are portable (the QBZR tools). I would still have to manually hack the .config files. But if the Tools menu would allow submenus, and if you could select/copy such submenus using cb_share_config, it would be almost the same as what I suggested. It would probably be good enough for much of my needs.

Still I think a generic source control plugin sounds like a great idea, especially if it could be configured in much the same way as the tools menu.

dushara

At the moment it's specific to git because it will be parsing the output of the git commands (e.g. git status --porcelain) to work out how to display the status of the project files. It may be possible to write a wrapper script to simulate the output of git.

But I'm getting ahead of myself here. It's still at the early stages right now.

Dushara.

dmoore

Quote from: cacb on November 21, 2010, 11:31:32 AM
So far it seems to work, but it could be more elegant. Perhaps your plugin is the answer. But in fact a slight improvement to the Tools menu facility would almost seem good enough
- Some way to define a submenu in the Tools menu
- Some way to export/import submenus to/from XML files, allowing for definitions to be moved to other machines.

The PowerShell plugin does exactly this (actually, import/export is to a flat file not xml). It's in need of a UI cleanup, suggetions welcome
Python plugins: [url="https://github.com/spillz/codeblocks-python"]https://github.com/spillz/codeblocks-python[/url]
Code::Blocks Daily Builds -- Ubuntu PPA: [url="https://launchpad.net/~damien-moore/+archive/codeblocks"]https://launchpad.net/~damien-moore/+archive/codeblocks[/url]

cacb

Quote from: dmoore on November 22, 2010, 04:06:37 PM
The PowerShell plugin does exactly this (actually, import/export is to a flat file not xml). It's in need of a UI cleanup, suggetions welcome

I have Code::Blocks 6840 (Win XP) and 6853 (Linux Kubuntu), but there is no PowerShell plugin included as far as I can tell. Is there a simple way I can get it without having to rebuild the IDE? I prefer to use the prebuilt Nightly Builds on Win and Linux.