Author Topic: Version control plug-in  (Read 9663 times)

Offline dushara

  • Multiple posting newcomer
  • *
  • Posts: 29
Version control plug-in
« on: November 20, 2010, 04:55:21 am »
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

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 12006
    • Travis build status
Re: Version control plug-in
« Reply #1 on: November 20, 2010, 11:04:25 am »
Code: [Select]
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!]

Offline dushara

  • Multiple posting newcomer
  • *
  • Posts: 29
Re: Version control plug-in
« Reply #2 on: November 21, 2010, 10:01:44 am »
Code: [Select]
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

Offline cacb

  • Regular
  • ***
  • Posts: 395
Re: Version control plug-in
« Reply #3 on: November 21, 2010, 11:31:32 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!

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 12006
    • Travis build status
Re: Version control plug-in
« Reply #4 on: November 21, 2010, 11:51:09 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!]

Offline cacb

  • Regular
  • ***
  • Posts: 395
Re: Version control plug-in
« Reply #5 on: November 21, 2010, 12:37:11 pm »
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.

Offline dushara

  • Multiple posting newcomer
  • *
  • Posts: 29
Re: Version control plug-in
« Reply #6 on: November 22, 2010, 10:30:05 am »
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.

Offline dmoore

  • Developer
  • Lives here!
  • *****
  • Posts: 1576
Re: Version control plug-in
« Reply #7 on: November 22, 2010, 04:06:37 pm »
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

Offline cacb

  • Regular
  • ***
  • Posts: 395
Re: Version control plug-in
« Reply #8 on: November 22, 2010, 08:44:32 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.