Author Topic: Slick-Macro for integrating TortoiseSVN resp. RabbitVCS to SlickEdit  (Read 4474 times)

abloewe

  • New Community Member
  • Posts: 1
  • Hero Points: 0
Hello,
I'm using Slick-Edit V14.0.1.2 for Windows and V15.0.1.3 for Linux. I've created a set of macros to integrated the easy-to-use UI of TortoiseSVN (for Windows) resp. RabbitVCS (for Linux) to SlickEdit. These macros can be added to the _ext_menu_default menu (Menu which is opened by right click on the current active file).
Precondition: TortoiseSVN for Windows/RabbitVCS for Linux has to be installed.

TortoiseSVN:


#define TORTOISE_SVN_BIN 'C:\\Programme\\TortoiseSVN\\bin'

_command TortoiseSVNExecTortoiseProc(_str params = '')
{
   cmd = 'start ';
   strappend (cmd, TORTOISE_SVN_BIN);
   strappend (cmd, '\\TortoiseProc.exe ');
   strappend (cmd, params);
   message (cmd);
   execute (cmd);
}

_command TortoiseSVNShowLog() name_info(','VSARG2_MACRO|VSARG2_MARK|VSARG2_REQUIRES_MDI_EDITORCTL)
{
   params = _parse_project_command('/command:log /path:"%F"' , p_buf_name, _project_get_filename(), '');
   TortoiseSVNExecTortoiseProc (params);
}

_command TortoiseSVNDiff() name_info(','VSARG2_MACRO|VSARG2_MARK|VSARG2_REQUIRES_MDI_EDITORCTL)
{
   params = _parse_project_command('/command:diff /path:"%F"' , p_buf_name, _project_get_filename(), '');
   TortoiseSVNExecTortoiseProc (params);
}

_command TortoiseSVNBlame() name_info(','VSARG2_MACRO|VSARG2_MARK|VSARG2_REQUIRES_MDI_EDITORCTL)
{
   params = _parse_project_command('/command:blame /path:"%F"' , p_buf_name, _project_get_filename(), '');
   TortoiseSVNExecTortoiseProc (params);
}

_command TortoiseSVNResolved() name_info(','VSARG2_MACRO|VSARG2_MARK|VSARG2_REQUIRES_MDI_EDITORCTL)
{
   params = _parse_project_command('/command:resolve /path:"%F"' , p_buf_name, _project_get_filename(), '');
   TortoiseSVNExecTortoiseProc (params);
}

_command TortoiseSVNRevertFile() name_info(','VSARG2_MACRO|VSARG2_MARK|VSARG2_REQUIRES_MDI_EDITORCTL)
{
   params = _parse_project_command('/command:revert /path:"%F"' , p_buf_name, _project_get_filename(), '');
   TortoiseSVNExecTortoiseProc (params);
}

_command TortoiseSVNRevertProject() name_info(','VSARG2_MACRO|VSARG2_MARK|VSARG2_REQUIRES_MDI_EDITORCTL)
{
   params = _parse_project_command('/command:revert /path:"%RW"' , p_buf_name, _project_get_filename(), '');
   TortoiseSVNExecTortoiseProc (params);
}

_command TortoiseSVNRepoBroswer() name_info(','VSARG2_MACRO|VSARG2_MARK|VSARG2_REQUIRES_MDI_EDITORCTL)
{
   params = _parse_project_command('/command:repobrowser /path:"%F"' , p_buf_name, _project_get_filename(), '');
   TortoiseSVNExecTortoiseProc (params);
}

_command TortoiseSVNCheckProject() name_info(','VSARG2_MACRO|VSARG2_MARK|VSARG2_REQUIRES_MDI_EDITORCTL)
{
   params = _parse_project_command('/command:repostatus /path:"%RW"' , p_buf_name, _project_get_filename(), '');
   TortoiseSVNExecTortoiseProc (params);
}

_command TortoiseSVNCommitProject() name_info(','VSARG2_MACRO|VSARG2_MARK|VSARG2_REQUIRES_MDI_EDITORCTL)
{
   params = _parse_project_command('/command:commit /path:"%RW"' , p_buf_name, _project_get_filename(), '');
   TortoiseSVNExecTortoiseProc (params);
}

_command TortoiseSVNCommitFile() name_info(','VSARG2_MACRO|VSARG2_MARK|VSARG2_REQUIRES_MDI_EDITORCTL)
{
   params = _parse_project_command('/command:commit /path:"%F"' , p_buf_name, _project_get_filename(), '');
   TortoiseSVNExecTortoiseProc (params);
}


_command TortoiseSVNCommitSelectableFolder() name_info(','VSARG2_MACRO|VSARG2_MARK|VSARG2_REQUIRES_MDI_EDITORCTL)
{
   updateFolder = _parse_project_command('%RW' , p_buf_name, _project_get_filename(), '');
   folder = _ChooseDirDialog("Select folder for TortoiseSVN Commit:",updateFolder,"",CDN_PATH_MUST_EXIST);

   if(folder != '')
   {
      _str params = '/command:commit /path:"';
      strappend (params, folder);
      strappend (params, '"');
      TortoiseSVNExecTortoiseProc(params);
   }
}


_command TortoiseSVNMergeProject() name_info(','VSARG2_MACRO|VSARG2_MARK|VSARG2_REQUIRES_MDI_EDITORCTL)
{
   params = _parse_project_command('/command:merge /path:"%RW"' , p_buf_name, _project_get_filename(), '');
   TortoiseSVNExecTortoiseProc (params);
}


_command TortoiseSVNUpdateFolder(_str updateFolder = '')
{
   folder = _ChooseDirDialog("Select folder for TortoiseSVN Update:",updateFolder,"",CDN_PATH_MUST_EXIST);

   if(folder != '')
   {
      _str params = '/command:update /path:"';
      strappend (params, folder);
      strappend (params, '"');
      TortoiseSVNExecTortoiseProc(params);
   }
}

_command TortoiseSVNUpdateFile_(_str updateFile = '')
{
   int res = textBoxDialog("TortoiseSVN Update", 0, 5000, '', '', '', 'Update File:'updateFile);
   if(res == 1)
   {
      _str params = '/command:update /path:"';
      strappend (params, _param1);
      strappend (params, '"');
      TortoiseSVNExecTortoiseProc(params);
   }
}


_command TortoiseSVNUpdateFile() name_info(','VSARG2_MACRO|VSARG2_MARK|VSARG2_REQUIRES_MDI_EDITORCTL)
{
   updateFile = _parse_project_command('%F' , p_buf_name, _project_get_filename(), '');
   TortoiseSVNUpdateFile_(updateFile);
}

_command TortoiseSVNUpdateProject() name_info(','VSARG2_MACRO|VSARG2_MARK|VSARG2_REQUIRES_MDI_EDITORCTL)
{
   updateFolder = _parse_project_command('%RW' , p_buf_name, _project_get_filename(), '');
   TortoiseSVNUpdateFolder(updateFolder);
}

_command TortoiseSVNUpdateWorkspace() name_info(','VSARG2_MACRO|VSARG2_MARK|VSARG2_REQUIRES_MDI_EDITORCTL)
{
   updateFolder = _parse_project_command('%WP' , p_buf_name, _project_get_filename(), '');
   TortoiseSVNUpdateFolder(updateFolder);
}


RabbitVCS:


_command RabbitVCSExec (_str params = '')
{
    cmd = 'rabbitvcs ';
    strappend(cmd, params);
    message (cmd);
    execute (cmd);

}

_command RabbitVCSShowLog() name_info(','VSARG2_MACRO|VSARG2_MARK|VSARG2_REQUIRES_MDI_EDITORCTL)
{
   params = _parse_project_command('log "%F"' , p_buf_name, _project_get_filename(), '');
   RabbitVCSExec (params);
}

_command void RabbitVCSDiff() name_info(','VSARG2_MACRO|VSARG2_MARK|VSARG2_REQUIRES_MDI_EDITORCTL)
{
    params = _parse_project_command ('diff -s "%F"', p_buf_name, _project_get_filename(), '');
    RabbitVCSExec (params);

}


_command RabbitVCSBlame() name_info(','VSARG2_MACRO|VSARG2_MARK|VSARG2_REQUIRES_MDI_EDITORCTL)
{
   params = _parse_project_command('annotate "%F"' , p_buf_name, _project_get_filename(), '');
   RabbitVCSExec (params);
}



_command RabbitVCSResolved() name_info(','VSARG2_MACRO|VSARG2_MARK|VSARG2_REQUIRES_MDI_EDITORCTL)
{
   params = _parse_project_command('markresolved "%F"' , p_buf_name, _project_get_filename(), '');
   RabbitVCSExec (params);
}



_command RabbitVCSRevertFile() name_info(','VSARG2_MACRO|VSARG2_MARK|VSARG2_REQUIRES_MDI_EDITORCTL)
{
   params = _parse_project_command('revert "%F"' , p_buf_name, _project_get_filename(), '');
   RabbitVCSExec (params);
}



_command RabbitVCSRevertProject() name_info(','VSARG2_MACRO|VSARG2_MARK|VSARG2_REQUIRES_MDI_EDITORCTL)
{
   params = _parse_project_command('revert "%RW"' , p_buf_name, _project_get_filename(), '');
   RabbitVCSExec (params);
}



_command RabbitVCSRepoBroswer() name_info(','VSARG2_MACRO|VSARG2_MARK|VSARG2_REQUIRES_MDI_EDITORCTL)
{
   //params = _parse_project_command('/command:repobrowser /path:"%F"' , p_buf_name, _project_get_filename(), '');
   params = _parse_project_command('browser "%F"' , p_buf_name, _project_get_filename(), '');
   RabbitVCSExec (params);
}



_command void RabbitVCSCheckProject() name_info(','VSARG2_MACRO|VSARG2_MARK|VSARG2_REQUIRES_MDI_EDITORCTL)
{
    //params = _parse_project_command('/command:repostatus /path:"%RW"' , p_buf_name, _project_get_filename(), '');
    params = _parse_project_command ('checkmods "%RW"', p_buf_name, _project_get_filename(), '');
    RabbitVCSExec (params);

}


_command RabbitVCSCommitProject() name_info(','VSARG2_MACRO|VSARG2_MARK|VSARG2_REQUIRES_MDI_EDITORCTL)
{
   params = _parse_project_command('commit "%RW"' , p_buf_name, _project_get_filename(), '');
   RabbitVCSExec (params);
}



_command RabbitVCSCommitFile() name_info(','VSARG2_MACRO|VSARG2_MARK|VSARG2_REQUIRES_MDI_EDITORCTL)
{
   params = _parse_project_command('commit "%F"' , p_buf_name, _project_get_filename(), '');
   RabbitVCSExec (params);
}



_command RabbitVCSCommitSelectableFolder() name_info(','VSARG2_MACRO|VSARG2_MARK|VSARG2_REQUIRES_MDI_EDITORCTL)
{
   updateFolder = _parse_project_command('%RW' , p_buf_name, _project_get_filename(), '');
   folder = _ChooseDirDialog("Select folder for RabbitVCS Commit:",updateFolder,"",CDN_PATH_MUST_EXIST);

   if(folder != '')
   {
      _str params = 'commit /path:"';
      strappend (params, folder);
      strappend (params, '"');
      RabbitVCSExec(params);
   }
}



_command RabbitVCSMergeProject() name_info(','VSARG2_MACRO|VSARG2_MARK|VSARG2_REQUIRES_MDI_EDITORCTL)
{
   params = _parse_project_command('merge "%RW"' , p_buf_name, _project_get_filename(), '');
   RabbitVCSExec (params);
}



_command RabbitVCSUpdateFolder(_str updateFolder = '')
{
   folder = _ChooseDirDialog("Select folder for RabbitVCS Update:",updateFolder,"",CDN_PATH_MUST_EXIST);

   if(folder != '')
   {
      _str params = 'update "';
      strappend (params, folder);
      strappend (params, '"');
      RabbitVCSExec(params);
   }
}


_command RabbitVCSUpdateFile_(_str updateFile = '')
{
   int res = textBoxDialog("RabbitVCS Update", 0, 5000, '', '', '', 'Update File:'updateFile);
   if(res == 1)
   {
      _str params = 'update "';
      strappend (params, _param1);
      strappend (params, '"');
      RabbitVCSExec(params);
   }
}



_command RabbitVCSUpdateFile() name_info(','VSARG2_MACRO|VSARG2_MARK|VSARG2_REQUIRES_MDI_EDITORCTL)
{
   updateFile = _parse_project_command('%F' , p_buf_name, _project_get_filename(), '');
   RabbitVCSUpdateFile_(updateFile);
}



_command RabbitVCSUpdateProject() name_info(','VSARG2_MACRO|VSARG2_MARK|VSARG2_REQUIRES_MDI_EDITORCTL)
{
   updateFolder = _parse_project_command('%RW' , p_buf_name, _project_get_filename(), '');
   RabbitVCSUpdateFolder(updateFolder);
}



_command RabbitVCSUpdateWorkspace() name_info(','VSARG2_MACRO|VSARG2_MARK|VSARG2_REQUIRES_MDI_EDITORCTL)
{
   updateFolder = _parse_project_command('%WP' , p_buf_name, _project_get_filename(), '');
   RabbitVCSUpdateFolder(updateFolder);
}


The _ext_menu_default can be extended as follows (for TortoiseSVN):

#include 'slick.sh'
_menu _ext_menu_default {
   "Explorer file","explore","","","";
   submenu "TortoiseSVN","","","" {
      "Show &log","TortoiseSVNShowLog","","","Show Subversion Log";
      "&Diff","TortoiseSVNDiff","","","";
      "&Blame","TortoiseSVNBlame","","","";
      "Res&olved","TortoiseSVNResolved","","","";
      "-","","","","";
      "&Commit project","TortoiseSVNCommitProject","","","";
      "Commit file","TortoiseSVNCommitFile","","","";
      "Commit selectable folder","TortoiseSVNCommitSelectableFolder","","","";
      "-","","","","";
      "&Update workspace","TortoiseSVNUpdateWorkspace","","","";
      "Update project","TortoiseSVNUpdateProject","","","";
      "Update file","TortoiseSVNUpdateFile","","","";
      "-","","","","";
      "Re&vert project","TortoiseSVNRevertProject","","","";
      "Revert file","TortoiseSVNRevertFile","","","";
      "-","","","","";
      "Check project","TortoiseSVNCheckProject","","","";
      "&Merge project","TortoiseSVNMergeProject","","","";
      "-","","","","";
      "SVN &Repo-browser","TortoiseSVNRepoBroswer","","","";
   }
....


Best regards
Andreas

matthewh

  • Junior Community Member
  • Posts: 4
  • Hero Points: 0
Re: Slick-Macro for integrating TortoiseSVN resp. RabbitVCS to SlickEdit
« Reply #1 on: October 05, 2011, 07:41:22 pm »
Hey this is awesome. I had to edit it a little to get it to work. Had to add:
#include "slick.sh"
and change the define to point to where tortoise is actually located on my machine and seems it needs to use 8.3 format:
#define TORTOISE_SVN_BIN 'C:\\PROGRA~1\\TORTOI~1\\bin'


lclevesy

  • Guest
Re: Slick-Macro for integrating TortoiseSVN resp. RabbitVCS to SlickEdit
« Reply #2 on: October 06, 2011, 01:49:58 pm »
@abloewe Thank you for your submission. It is in the running for the iPad!

The winner will be announced via our Facebook page https://www.facebook.com/slickedit, Twitter page http://www.twitter.com/slickedit, and on this forum under the main SlickEdit October Macros Challenge Rules & How to Enter post http://community.slickedit.com/index.php/topic,7327.0.html on November 7, 2011.

@matthewh Thank you for your input, it's great to see our users collaborating to create the highest quality macros! I hope you'll submit a macro to the challenge! 

lclevesy

  • Guest
Re: Slick-Macro for integrating TortoiseSVN resp. RabbitVCS to SlickEdit
« Reply #3 on: November 01, 2011, 03:15:45 pm »
We'll be announcing the winner of the iPad 2 on November 7th. Until then, your submission has earned a SlickEdit t-shirt! Email your size and address to marketing@slickedit.com to receive one.