Using TortoiseSVN Version Control with ISESteroids

Anyone editing PowerShell source code will, sooner or later, realizes they need a way to keep multiple versions of source code changes. And, if you use PowerShell to develop in a team environment then source control moves from being a “nice to have” to a “must have” tool.

I had a few prerequisites when looking for a PowerShell editor. First, I wanted an editor that allowed source control management (versioning) to be callable from within the Windows PowerShell ISE. Second, I did not want to use a new tool since I had already used SVN as my source control provider.

With that said, I started looking around for PowerShell editors that would support source code control, but the ones I found where either too expensive or forced me into using “their” source control product. As luck had it, I discovered ISESteriods for PowerShell and started to explore how they handled source code versioning, and although the product has a built in versioning tool, see this link, I still wanted to find a way to that would allow me to use my existing SVN source code control provider.

One of the really nice features of ISESteroids is the ability to extend it, so with a little ingenuity and research I was able to connect ISESteroids to my SVN source control provider. I did this using TortoiseSVN, which is a Windows shell extension. It’s very easy to use because it eliminates the need to use the Subversion command line client, and best of all, it is free to use even in a commercial environment.

Obviously, in order to use TortoiseSVN from within Windows PowerShell ISE running ISESteroids, you need to have TortoiseSVN installed. To do that go to this page, and follow the instructions for installing it in your environment.

Now that we have TortoiseSVN installed, I had to find a way to call TortoiseSVN commands from Windows PowerShell ISE running ISESteroids. I did some research and found that TortoiseSVN can be automated because all the commands are controlled through command line parameters; hence, you can automate specific commands and dialogs from other programs — one of which is Windows PowerShell ISE running ISESteroids. I refer you to the following web page, which explains the commands and their command line parameters.

Now the fun part…connecting TortoiseSVN commands to the Windows PowerShell ISE running ISESteroids. I wanted to provide the following SVN commands to my editing sessions, but any SVN command exposed to command line automation can be added:

  • Show Log
  • SVN Commit
  • SVN Add
  • SVN Update
  • SVN Diff
  • SVN Blame

First, ISESteroids allows you to add your own commands to the main menu in order to call external programs, web sites, et cetera. These commands were saved in a file called: Microsoft.PowerShellISE_profile.ps1, which can be accessed by clicking the button to open the personal ISE Autostart Script.

 

 

BlogPic1

By adding commands to this file, whenever Windows PowerShell ISE running ISESteroids is started, it will execute these commands making them available within the editor. After I added the commands I wanted to use to the file, and finally figuring out how to call the commands with the correct parameters, my menu looks like this:

BlogPic2

When I click on the menu item TortoiseSVN I am presented with the following submenu:

BlogPic3

If I click on any of those menu items, they call the SVN command line with its parameters, and open a SVN window from with my editing session. This eliminates having to switch over to Windows Explorer to run these commands in order to work with my version control provider.

Let’s take a look at each of these command from within an editing session to see what they do.

Show Log: Shows a log of all the changes with the source control repository.

BlogPic4

SVN Commit: Identifies items that have changed and are waiting to be updated within the source control repository.

BlogPic5

SVN Add: Adds any new items to the source control repository.

BlogPic6

SVN Update: This is a tricky one, it is updating your local files from the source control repository; it is NOT updating the source control repository that is what SVN Commit does.

BlogPic7

SVN Diff: Compares the differences between the current file you are editing and the latest version in the source control repository.

BlogPic8

SVN Blame: Useful in a team environment to identify the person that made the changes to the file.

BlogPic9

The challenging part was figuring out the correct syntax to use when calling the external commands. Most of my time was spent researching and testing these commands from within the Windows PowerShell ISE running ISESteroids. In order to save others the time, and clearly show what the command line calls should look like, I listed the commands below for all the SVN actions I automated.

Add TortoiseSVN Menu Item:
$parent = $psise.CurrentPowerShellTab.AddOnsMenu.SubMenus.Add(‘TortoiseSVN’, $null, $null)

Show Log Menu Item:
$parent.Submenus.Add(‘Show Log’, { &’C:\Program Files\TortoiseSVN\bin\TortoiseProc.exe’ ‘/command:log’ ‘/path:”C:\Users\zrmfld\Documents\ActiveDocuments\PSScripts\*.*”‘ ‘/closeonend:0’ }, ‘ALT+L’ )

SVN Commit Menu Item:
$parent.Submenus.Add(‘SVN Commit’, { &’C:\Program Files\TortoiseSVN\bin\TortoiseProc.exe’ ‘/command:commit’ ‘/path:”C:\Users\zrmfld\Documents\ActiveDocuments\PSScripts\”‘ }, ‘ALT+C’ )

SVN Add Menu Item:
$parent.Submenus.Add(‘SVN Add’, { &’C:\Program Files\TortoiseSVN\bin\TortoiseProc.exe’ ‘/command:add’ ‘/path:”C:\Users\zrmfld\Documents\ActiveDocuments\PSScripts\*.*”‘ }, ‘ALT+A’ )

SVN Update Menu Item:
$parent.Submenus.Add(‘SVN Update’, { &’C:\Program Files\TortoiseSVN\bin\TortoiseProc.exe’ ‘/command:update’ ‘/path:”C:\Users\zrmfld\Documents\ActiveDocuments\PSScripts\’ }, ‘ALT+U’ )

SVN Diff Menu Item:
$parent.Submenus.Add(‘SVN Diff’, { &’C:\Program Files\TortoiseSVN\bin\TortoiseProc.exe’ ‘/command:prevdiff’ (‘/path:”‘ + ($psise.PowerShellTabs.SelectedPowerShellTab.Files.SelectedFile.FullPath) +'””’) ‘/closeonend:0’ }, ‘ALT+D’ )

SVN Blame Menu Item:
$parent.Submenus.Add(‘SVN Blame’, { &’C:\Program Files\TortoiseSVN\bin\TortoiseProc.exe’ ‘/command:blame’ (‘/path:”‘ + ($psise.PowerShellTabs.SelectedPowerShellTab.Files.SelectedFile.

It may be difficult to see where the spaces and single and double quotes reside in the lines above, so I added a text file that can be downloaded from here TortoiseSVN Profile Commands. Also, the folder you designate to be under SVN source control, my folder was C:\Users\zrmfld\Documents\ActiveDocuments\PSScripts\, will have to be changed to match the folder you are using.

In closing, I hope this helps makes using ISESteroids that much more beneficial. It is a great package with many features to improve your productivity. In the future I look forward to writing some more posts on its other features. If there is enough interest, and may work on interfacing it with the “Git” version control provider.

 

 

50 thoughts on “Using TortoiseSVN Version Control with ISESteroids

  1. Pingback: Support for SVN Version Control

  2. advogado lisboa

    I simply wanted to compose a quick comment so as to say thanks to you for these nice suggestions you are giving out at this website. My extended internet investigation has now been rewarded with wonderful facts and strategies to exchange with my guests. I ‘d repeat that most of us readers are very much lucky to dwell in a perfect site with so many perfect people with insightful tactics. I feel rather grateful to have used your webpage and look forward to so many more pleasurable moments reading here. Thanks again for a lot of things.

    Reply
  3. Pingback: Adding New Context Menus

  4. loshi

    Great post. I was checking constantly this blog and I am impressed!
    Very useful information particularly the last part 🙂 I care for such info much.
    I was seeking this particular information for a long time.

    Thank you and good luck.

    Reply
  5. bomb it 7

    What’s Happening i am new to this, I stumbled upon this I’ve discovered It positively useful and it has helped
    me out loads. I am hoping to give a contribution & assist other customers like its helped me.
    Good job.

    Reply
  6. Jimmy Heffern

    After examine a few of the weblog posts in your website now, and I actually like your approach of blogging. I bookmarked it to my bookmark web site list and shall be checking again soon. Pls take a look at my web page as nicely and let me know what you think.

    Reply
  7. MerleWAmsili

    Hey! I really desired to ask if you possess any issues with hackers?

    My last blog (wordpress) was hacked and I finished
    up losing few weeks of work on account of no backup.

    Are you experiencing any solutions to prevent hackers?

    Reply
    1. fdijohn Post author

      Hi! To date I have not experienced any issues. I did not add anything special, except what WordPress adds. The other plugins I use are: Display Posts Shortcode,
      Exclude Pages from Navigation, Go Daddy Quick Setup, Post Types Order, Sidekick, WP Statistics, WP101 Video Tutorials.

      Reply
  8. ZoilaSCoward

    Hi there! Someone inside my Facebook group shared this website around and so i came to have a look.

    I’m definitely enjoying the details. I’m book-marking
    and are tweeting this to my followers! Great blog and amazing design.

    Reply
  9. HalinaTFagen

    you are actually a good webmaster. The web site loading velocity is incredible.
    It kind of feels that you are doing any unique trick.

    Also, The contents are masterpiece. you have done a wonderful activity in this topic!

    Reply
  10. LiseFMeisner

    wonderful issues altogether, you just received a brand new reader.
    What would you suggest in regards to your put up
    which you made some days in the past? Any positive?

    Reply
  11. RyannKWorlow

    Howdy! I could possibly have sworn I’ve been to your blog site before but after experiencing a few of the posts I realized
    it’s new to me. Nonetheless, I’m definitely happy
    I discovered it and I’ll be book-marking
    it and checking back frequently!

    Reply
  12. LaneTVaros

    Excellent blog here! Also your site lots
    up fast! What hosting company are you currently using? Can I am just getting your associate link for the host?
    I want my site loaded up as quickly as yours lol

    Reply
  13. SheliaHMesch

    I am going to immediately seize your rss when i can’t to get your e-mail subscription hyperlink or newsletter service.

    Do you’ve any? Please let me know in order that I might just subscribe.

    Thanks.

    Reply
  14. check my source

    I simply want to tell you that I am just very new to blogging and actually enjoyed your web blog. More than likely I’m planning to bookmark your blog . You really come with exceptional writings. Thanks a bunch for sharing with us your web page.

    Reply
  15. KeniaHNadell

    My brother recommended I might like this website. He was entirely right.
    This post actually made my day. You can not imagine just how much time I had spent for this
    info! Thanks!

    Reply
  16. JacksonRRoye

    You’re so awesome! I actually do not suppose I’ve truly go through a single thing such as this before.
    So good to get someone with a few genuine ideas on this subject.

    Seriously.. thank you for starting this up. This web site is a thing that’s needed on the internet, someone with
    some originality!

    Reply
  17. NickiAOber

    I had been recommended this website by my cousin.
    I am not sure whether this post is authored by him as nobody else know such detailed
    about my problem. You will be amazing! Thanks!

    Reply
  18. CeolaWEckley

    Thank you, I have recently been searching for information approximately
    this topic for ages and yours is the greatest I’ve discovered till now.
    However, what concerning the conclusion? Are you certain in regards to the supply?

    Reply
  19. OnieNDufficy

    I blog quite often and I genuinely thank you for your
    information. The article has really peaked my interest.
    I am going to take a note of your blog and keep checking for new information about once a
    week. I subscribed to your RSS feed as well.

    Reply
  20. DarbyXKessel

    Excellent post. I was previously checking constantly this weblog and I am just impressed!
    Very useful info particularly the last section 🙂 I cope with such info a lot.
    I was seeking this particular info for a very long time.
    Thanks and better of luck.

    Reply
  21. robe femme wish

    Very soon this web page will be famous among all blog users, due to it’s fastidious content. This is really nice to know. I hope it will be successful in the future. Good job on this and keep up the good work.

    Reply
  22. WadeZGheza

    All things are very open by using a clear clarification from the issues.
    It had been really informative. Your internet site is extremely helpful.
    Thanks a lot for sharing!

    Reply
  23. TeddyTBordes

    Fantastic goods of your stuff, man. I’ve have at heart your stuff ahead of and you
    are just extremely excellent. I actually like what
    you’ve obtained here, really like what you’re stating and the
    best way where you assert it. You’re making it entertaining and you consistently
    take care of to stay it smart. I cant wait to read much more from you.

    This really is actually a wonderful website.

    Reply
  24. JamilaFHaw

    I’m truly experiencing and enjoying the design and layout
    of the blog. It’s an extremely easy in the eyes rendering it considerably more enjoyable for me
    personally ahead here and visit on a regular basis.
    Would you hire out a designer to generate your theme?
    Fantastic work!

    Reply

Leave a Reply

Your email address will not be published.