简体   繁体   中英

Setting up Tortoise SVN Windows 7 hotkeys

How would one go about setting up some hotkeys for commonly used SVN actions such as diff?

Currently to view diff, I have to select file(s), then right click, navigate to TortoiseSVN and then select Diff action. Quite a few steps for something used often.

Instead, I would like to select file and use hotkey(for example Ctrl-Alt-F) to do the same Diff action.

Searching for solutions, I have found some people running AutoHotKey scripts to do similar things, but it seems like an overkill.

I made a hotkey shortcut(using standard Win 7 method of creating a shortcut then adjusting its properties) to run TortoiseMerge, which is the tool that displays the diff, but such a shortcut ignores current file selection and brings up a blank TortoiseMerge.

Any ideas to try?

You can modify the TortoiseSVN context menu and place your favorite commands at the root of the context menu. This way you have only to click twice for a diff. Not that much, I think.

TortoiseSVN设置 - 上下文菜单

Another option would be to use an advanced file manager (like Total Commander or FreeCommander) which enables you to define custom menu commands with custom hot keys.

In Total Commander this would be "Change Start Menu":

  • Command: C:\\Program Files (x86)\\TortoiseSVN\\bin\\TortoiseProc.exe
  • Parameters: /command:diff /path:%P\\%N
  • Shortcut Key: CRTL+ALT+F1

Whether shell context menu or hotkey, you need at least 2 steps to run a TortoiseSVN command:

  1. Select the file (selecting and right clicking to open the context menu is a single action)
  2. Run the command (click on the context menu item or press the shortcut key)

From this point of view it's just a question of your personal preference: should I click twice or should I click once and leave the mouse for pressing a key? ;-)

You could try directly calling the process with the correct parameters instead of worrying about right-click context menus.

For example, I was able to set up a shortcut directly to the following item:

"C:\Program Files\TortoiseSVN\bin\TortoiseProc.exe" /command:update /path:"c:\Source"

From there, you can call this shortcut from your hotkey program, or if you prefer a out-of-the-box solution, map a folder directly to the task bar (I labeled mine "o" for aesthetics) and stick that shortcut in this folder.

Theoretically, you could have one shortcut per operation, per repository.

Looking at the problem more generally, I'd say that this is a workflow issue. Presumably the reason you want to find a quicker way of finding diffs is because you want to do it for a number of files. In that case, go to the root of your working copy and choose TortoiseSVN -> Check for modifications . That will show you a list of changed files. Do get the diffs, just double click on each.

Autohotkey is overkill for a single key, but you can collect the hotkeys for actions you might perform in any window type all in a single script. As a result, you can have hotkeys perform fairly complex actions in one class of windows, and the same hotkeys perform different actions in another window type using the '#IfWinActive' directive.

For example, this URL mentions adding hotkeys for commit and update; you could add a key for your diff need, and perhaps one for log or some other svn option you perform frequently.

For some reason, bringing up the explorer context menu is slow for me in Windows 7. Adding these hotkeys really improved my workflow.

Note: you can also prefix that URL's example code with the following:

GroupAdd explorers, ahk_class ExploreWClass
GroupAdd explorers, ahk_class CabinetWClass

#IfWinActive ahk_group explorers

And suffix it with:

#IfWinActive

And those specific hotkeys will execute the TortoiseSVN-specific commands when Windows Explorer has focus, and be passed through in all other cases.

Install the StExBar , then add commands for diff/update/commit/... and specify the corresponding TortoiseProc.exe command. And of course assign a hotkey for the command.

You can use context menu shortcuts. Just open code folder in explorer and use below:

Commit: alt + F + C
update: alt + F + U
Check for updates: alt + F + T + F

So you can press above keyboard shortcuts to commit instead of having to right click directory then click commit.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM