Keyboard shortcuts for Compare with Latest Version / Compare with Workspace version in Visual Studio 2012 - tfs

This was easy in VS 2010, but I can't find the right items in VS 2012.
I'd like to set keyboard shortcuts for the Compare With Latest/Workspace Version context menu items in the TFS Pending Changes view. What's the item I should select in the Keyboard section of the Tools dialog?

(This was tested with Visual Studio 2012 Update 1)
Tools > Options > Environment > Keyboard >
Under Show commands containing search and assign key combinations to:
TeamFoundationContextMenus.PendingChangesPageChangestoInclude.TfsContextPendingChangesPageCompareWithPreviousVersion - compares pending item in context to previous version.
TeamFoundationContextMenus.PendingChangesPageChangestoInclude.TfsContextPendingChangesPageCompareWithLatestVersion - compares pending item in context to latest version.
TeamFoundationContextMenus.PendingChangesPageChangestoInclude.TfsContextPendingChangesPageCompareWithWorkspaceVersion - compares pending item in context to workspace version.
File.TfsCompare - open the compare dialog.

For me, this worked:
VS > Tools > Options > Environment > Keyboard > Show Commands Containing: Team.Git.CompareWithUnmodified
By assigning a shortcut key Ctrl+\, Ctrl+\ to this command ( Team.Git.CompareWithUnmodified) I can now compare my current file (the file that is open in the editor) to the previous version of the file by pressing the shortcut key Ctrl+\, Ctrl+\; no need to find the file in solution explorer, then right-click the file then select Compare.
(you can choose your own shortcut key of course)
Just a note on different behaviour:
Team.Git.CompareWithUnmodified works for me because I am using TeamExplorer in VisualStudio but I use GIT as the underlying source code repository.
Tfs.FileCompare could also work in other scenarios (i.e. if you don't use Git, but use VSTS or TFS as your source control provider).
Other: the command will be different if you use another source control provider.

While you have the file open use this combo to compare with Workspace version:
Menu, O, C, Enter
(This performs Right Click > Source Control > Compare > Workspace Version)
If your keyboard doesn't have a Menu key, do this:
Set the hotkey for File.TfsCompare to Ctrl+\ Ctrl+\
Use the combo: Ctrl+[ Ctrl+S Ctrl+\ Ctrl+\ Enter

Related

TFS Rollback Renamed File Without Manual Intervention to Rename It (TFVC)

In TFS 2012 (TFVC), how might I rollback a renamed file to the original filename and contents--without having to manually rename the file (?)
Trying to see if possible just using TFS rollback functionality (e.g., tf rollback), not a combination of tf commands or scripted solution.
SITUATION
Four steps: 1) Add a file; 2) Check it in; 3) Rename the file and edit the contents; and 4) Check it in:
Changeset: 2
Items:
rename, edit $/b.txt
Changeset: 2
Items:
delete, source rename $/a.txt
Changeset: 1
Items:
add $/a.txt
I want to rollback to Changeset 1 (a.txt).
WHAT I'VE TRIED
Source Control Explorer Rollback:
In Microsoft Visual Studio 2017 Professional's Source Control Explorer: right-click b.txt > Rollback... > Rollback to a specific version. Specify Changeset 1, then select button Rollback.
This produces the following pending change:
Items:
delete, rollback $/b.txt
Additionally, a warning appears in Output window:
TF203066: The rename from $/a.txt to $/b.txt could not be rolled back
because you did not provide the source name. To roll back the rename,
undo any pending changes to $/b.txt, and then repeat the operation,
but this time include both the source name ($/a.txt) the target name
($/b.txt).
Note: "Rollback to a specific version" doesn't seem to have fields for source and target names.
This seems to indicate rollback doesn't support this scenario (?)
tf.exe Rollback:
Command tf rollback also doesn't seem to have parameters for source and target names:
tf rollback /toversion:VersionSpec ItemSpec [/recursive]
[/lock:none|checkin|checkout] [/version:versionspec]
[/keepmergehistory] [/login:username,[password]] [/noprompt]
When I run the following command, I get the same results as in Visual Studio:
C:\test>tf vc rollback /toversion:C1 "$/b.txt"
delete, rollback:
$/b.txt;C2~C2 -> $/b.txt;C2
as well as the same warning as before:
TF203066: The rename from $/a.txt to
$/b.txt could not be rolled back because you did not provide the
source name. To roll back the rename, undo any pending changes to
$/b.txt, and then repeat the operation, but this time include both the
source name ($/a.txt) the target name ($/b.txt). C:\test>
Note: tf rename has parameters olditem and newitem, which seems to imply warning TF203066 comes from an incomplete call to tf rename.
This seems to imply manual intervention will always be required to rename the file (?)
SOFTWARE VERSIONS
Microsoft Team Foundation Server 2012 CU4 v11.0.61030.0 (TFVC)
Microsoft Visual Studio 2017 Professional 15.9.13
LINKS
Rollback Command (Team Foundation Version Control)
Rename Command (Team Foundation Version Control)

How to remap "Go to definition" and "Rename all instances" on ZeroBrane Studio?

I'm using ZeroBrane Studio 1.30
Is there any way to remap the Ctrl/Cmd-DoubleClick shortcut to something on the keyboard, like Ctrl-R? (Without the mouse click) on the user preferences?
At the same time, is there a way to remap the "Go to definition" shortcut to something else than Ctrl/Cmd+Alt+Click.
I already tried these with no luck:
keymap[ID.RENAMEALLINSTANCES] = "Ctrl-R"
editor.keymap[#editor.keymap + 1] = {('R'):byte(), wxstc.wxSTC_SCMOD_CTRL, ID.RENAMEALLINSTANCES}
Also instead of ID.RENAMEALLINSTANCES I've tried ID_RENAMEALLINSTANCES with no luck.
Not in 1.30 (which is the currently released version). This functionality has already been added and will be available in the next release (or you can use the current master branch).

TFS checkin policy with ReSharper Cleanup Code

We are trying to have ReSharper's cleanup code run on TFS Checkin. Ideally, when you right click on the solution / project and select Source Control > Check in all the files in the "Included Changes" should run cleanup code. I've got the custom checkin policy to work to some extent, works fine if you select a single file to check in but when you select the solution or project, it tries to run cleanup code on the entire solution / project and not just the files selected in TFS Pending Changes "Include Changes".
I'm running VS 2013 with R# 8.2. My policy evaluate code:
public override PolicyFailure[] Evaluate()
{
if (PendingCheckin.Policies.EvaluationState == PolicyEvaluationState.Unevaluated)
{
DTE2 dte = PendingCheckin.GetService(typeof (DTE)) as DTE2;
foreach (EnvDTE.Document doc in dte.Documents)
{
doc.DTE.ExecuteCommand("ReSharper_SilentCleanupCode");
}
}
return new PolicyFailure[0];
}
I don't think this only applies to ReSharper, executing "Edit.FormatDocument" here would most likely run on all files as well.
Is there a way to run ExecuteCommand on only 1 file / document?
It seems like
PendingCheckin.GetService(typeof (DTE))
only gets files that are open in the Visual Studio editor not all the files that are in the "Include Changes" list. I can get a list of PendingChange through
PendingCheckin.PendingChanges.CheckedPendingChanges
But I don't know how to execute a command on PendingChange. Recommendations here would help
PS: I've read that the check in policy is meant to be used for checking documents only, however this workflow is what we need.

Cascading Context Menu Explorer CommandStore Missing

I'm trying to create a new cascading menu for the windows context menu but in my registry on Windows Vista I do not have a CommandStore Key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\ and if I add one it does not work.
For instance if I was to say do this:
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\*\Shell\Menu]
"MUIVerb"="ZIP"
"SubCommands"="SFX"
"icon"="c:\Program Files\7-Zip\7z.exe"
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\SFX]
#="Compress To Exe"
"icon"="c:\Program Files\7-Zip\7z.exe"
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\SFX\command]
#=""c:\Program Files\7-Zip\7z" u -mx9 -sfx -r -t7z "%1.exe" "%~f1""
All I get is a menu item called ZIP but no sub menus and an error when clicked.
This will not work, am I doing something wrong, or is there a better way to do this?
As far as I know this can be done only with Windows 7 (and potentially later versions)

Subscribing to file check ins with tfs 2010 alerts

I am trying to setup alerts to the team when a specific file is checked into TFS, have have found some info on this using tfs 2008, which leads me to believe the following filter should work:
'Artifacts/Artifact[starts-with(#ServerItem, $/Matrix/Dev/Matrix/Applications/Matrix.UI/Web.Config)]' <> NULL
But this just give me an Invalid Token error, any ideas how i get this working in 2010?
Thanks.
With installed Power Tools, right-click in Team Explorer on the upmost node (the icon for the TeamCollection) & open "Alerts Explorer".Generate a new CheckIn alert:
now set the source control pathto the files you 're interested in:
This generated a Filter Expression = 'Artifacts/Artifact[starts-with(translate(#ServerItem, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "abcdefghijklmnopqrstuvwxyz"), "$/foo/bar.cs")]' <> null

Resources