Advertisement
einWikinger

Tortoise SVN VS 2008 Integration Macros

May 20th, 2011
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Imports System
  2. Imports EnvDTE
  3. Imports EnvDTE80
  4. Imports EnvDTE90
  5. Imports System.Diagnostics
  6.  
  7. ' TortoiseSVN integration macros to be put into the VS2008 Toolbar or
  8. ' into context menus for files
  9. ' Created 2010 by Oliver Iking
  10. ' Follow me on twitter: http://www.twitter.com/einWikinger
  11. ' To embed the macros into your VS toolbar, simply create a new
  12. ' toolbar and drag the macros from the commands list into it!
  13. ' Or bind it to a shortcut. Integrate it into context menus. As you like!
  14.  
  15. Public Module TortoiseSVNIntegration
  16.  
  17.     ' Executes a SVN command on the currently selected file (might be the focused file in the editor
  18.    ' or in the project tree, depending on the context)
  19.    Sub DoSVNCommandOnCurrentFile(ByVal command As String)
  20.         If Not (DTE.ActiveDocument Is Nothing) Then
  21.             Dim filename As String = DTE.ActiveDocument.FullName
  22.             Dim commandString = "tortoiseproc /command:" + command + " /path:" + filename
  23.             'Dim commandLine = "cmd /c """ + commandString + """"
  24.            'Shell(commandLine, AppWinStyle.NormalFocus, True, 100)
  25.            Dim procid As Integer = Shell(commandString, AppWinStyle.NormalFocus, True, 1000)
  26.         End If
  27.     End Sub
  28.  
  29.     ' Diffs the current file against the latest revision.
  30.    Sub DiffCurrentFile()
  31.         DoSVNCommandOnCurrentFile("diff")
  32.     End Sub
  33.  
  34.     ' Shows revision log for current file
  35.    Sub RevLogOfCurrentFile()
  36.         DoSVNCommandOnCurrentFile("log")
  37.     End Sub
  38.  
  39.     Sub RevertCurrentFile()
  40.         DoSVNCommandOnCurrentFile("revert")
  41.     End Sub
  42.  
  43.     Sub BlameCurrentFile()
  44.         DoSVNCommandOnCurrentFile("blame")
  45.     End Sub
  46.  
  47.     Sub CommitCurrentFile()
  48.         DoSVNCommandOnCurrentFile("commit")
  49.     End Sub
  50.  
  51.     Sub UpdateCurrentFile()
  52.         DoSVNCommandOnCurrentFile("update")
  53.     End Sub
  54.  
  55.     Sub AddCurrentFile()
  56.         DoSVNCommandOnCurrentFile("add")
  57.     End Sub
  58.  
  59. End Module
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement