Merge separate projects into one solution and not loose the history in TFS - tfs

I have 2 separate solutions in TFS, the structure is shown below:
App.A1
App.A1.Web
App.A2
App.A2.Core
App.A2.Web
Now I want to merge it to one solution. Additionally, I want App.A2.Core to became common Core project for 2 Web projects, so finally it should look like below:
App.B
App.B.Core
App.B.A1.Web
App.B.A2.Web
I'm using TFS. How it should be done not to loose history ?
Are the following steps:
Creating App.B solution folder in Source Control
Branching App.A1.Web, App.A2.Web and App.A2.Core to this folder
Changing names App.A1.Web -> App.B.A1.Web, App.A2.Web -> App.B.A2.Web, App.A2.Core -> App.B.Core
a good solution ?

Renaming and moving files in TFS2010 will disconnect the history but not lose it.
So, if I move file X in folder A to folder B then the history of X starts again in B. It will however still be in A (if you switch on the ability to see deleted files) where you can view the full history of X.
Similar story if you rename file X to be Y. The history of Y starts, the "deleted" X still has full history.
What this means for you is that the history is never lost.
As for what you want to do here's what I'd do:
Repurpose the App.A1 solution as App.B solution
Move all the App.A2 projects to be with the App.A1/B solution
Delete the App.A2 solution

Related

how to Remove "open with Gitkraken" from context menu?

I have a wasteful option left after uninstalling Gitkraken in windows 7 ultimate 64bit. I have tried many options like,
in regidit i have searched in following places:
[HKEY_CLASSES_ROOT\*\shell]
[HKEY_CLASSES_ROOT\*\shellex\ContextMenuHandlers]
[-HKEY_CLASSES_ROOT\Directory\background\shell\git_gui]
[-HKEY_CLASSES_ROOT\Directory\background\shell\git_shell]
[-HKEY_CLASSES_ROOT\Directory\Shell\git_gui]
[-HKEY_CLASSES_ROOT\Directory\Shell\git_shell]
[-HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\background\shell\git_gui]
[-HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\background\shell\git_shell]
[-HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\shell\git_gui]
[-HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\shell\git_shell]
HKEY_CLASSES_ROOT\*\OpenWithList
HKEY_CLASSES_ROOT\*\shellex\ContextMenuHandlers
HKEY_CLASSES_ROOT\Directory\Background
HKEY_CLASSES_ROOT\Directory\shell
HKEY_CLASSES_ROOT\Directory\shellex\ContextMenuHandlers
HKEY_CLASSES_ROOT\Drive\shell
HKEY_CLASSES_ROOT\Drive\shellex\ContextMenuHandlers
HKEY_CLASSES_ROOT\Folder\shell
HKEY_CLASSES_ROOT\Folder\shellex\ContextMenuHandlers
but i have got nothing related to git or git kraken so that i can remove that option.
It's worth noting that there are two items added to the context menu, one for each of the two right-click contexts. And as such, two entries exist in the Registry.
Context 1 - In the parent folder, when right-clicking on the folder icon of the repository:
HKEY_CLASSES_ROOT\Directory\shell\GitKraken
Context 2 - Within the repository folder, right-clicking on background white-space:
HKEY_CLASSES_ROOT\Directory\Background\shell\GitKraken
I tend to use the second one more often, and there was a bug when I first installed the program. In order to fix this bug, change the last argument from %L to %V.
From:
"C:\Users\Paul\AppData\Local\gitkraken\update.exe" --processStart=gitkraken.exe --process-start-args="-p %L"
To:
"C:\Users\Paul\AppData\Local\gitkraken\update.exe" --processStart=gitkraken.exe --process-start-args="-p %V"
The entry is here on my machine:
HKEY_CLASSES_ROOT\Directory\Background\shell\GitKraken
I'm not clear from the format of your list where you were actually checking, but that might be worth a look.
[-HKEY_USERS\...
S-1-5-21-307178686-3694073347-4169164670-1001\...
Software\Classes\Directory\shell\GitKraken]
S-1-5-21-307178686-3694073347-4169164670-1001 should be related to your user
Here is my screenshot choose the one without the classes should be right.

TFS - Merge code from two versions of same file ( in same branch )

I have Two change sets in TFS (for a single file) , for example 8901 and 9053.
I want to merge the code in both these change sets.
When I select both the change sets, I don't find any option except compare and copy. Please refer below screenshot of the same.
I want to merge these two changesets so that I the file will finally contain both the versions of code.
Any suggestions on how to achieve this? Please help.
Thanks in Advance.
Merge is using between branches, not between changesets.
It seems 9053 is the latest version of your project, so you should have get this version in your workspace. In my example, it's TestCaseProject.
Then you can try to create a branch for this project from 8901, named TestCaseProject-branch:
After that, perform a merge from TestCaseProject to TestCaseProject-branch, and you can check whether TestCaseProject-branch includes all changes you need in 8901 and 9053.

A way to find out all affected files of a workItem or group of chgsets in TFS 2008?

I'm trying to figure out a way to find out which files were affected by a work item in TFS 2008.
I realize that this is a duplication of a question already asked by someone else here - View a list of all files changed as part of a Workitem in TFS but it went unanswered and I've been, off and on, looking for this for a while.
I understand can view the links tab of the work item and then view each changeset to see the files that have been changed. But, the work item very likely will end up with many changesets linked to it, and I would like to review the files modified as part of the work item, but I feel like the likelihood of missing a file or two is very high if I have to rely on looking at each of the 100+ changesets individually.
Does anyone know of a way to accomplish this? Thanks in advance for any help or guidance.
Sounds like a job for Powershell...
function Get-TfsItem([int] $workItemNumber)
{
Get-TfsServer njtfs -all |
foreach { $_.wit.GetWorkItem($workItemNumber) } |
foreach { $_.Links } |
foreach { ([regex]'vstfs:///VersionControl/Changeset/(\d+)').matches($_.LinkedArtifactUri) } |
foreach { $_.groups[1].value } |
Get-TfsChangeset |
Select-TfsItem |
Sort Path -Unique
}
The first several lines are kind of ugly. We have to hit the webservice API directly since the TFS cmdlets don't cover the bug tracking system. And the objects we get back require some regular expression love before they'll do what we need. Piping to "foreach" over & over is an unfortunate Powershell idiom that arises when you mate an unfriendly API to a lame projection operator. (I use my own replacement, personally, but you can't rely on that.)
The last 3 lines should be self explanatory if my TFS Power Cmdlets are installed & doing their job.
I just found Scrum Power Tools plugin for VS 2010 that does this with a button click in VSS, installed and it worked. http://visualstudiogallery.msdn.microsoft.com/3f261226-530e-4e9c-b7d7-451c2f77f262
I am just trying to make the powershell version 2010 work. http://msdn.microsoft.com/en-us/vstudio/bb980963
First problem is that the pwoer shell option is not installed by default, use custom install and select that option. When completed there is a powershell prompt in the TFS powertools 2010 menu, the commands only work in there.
The get server I had to replace njtfs with the url http://tfsserver:8080/tfs and remove -all. The script still fails.
Ultimately I need a detail report that lists:
source 'work item' 'change set'
For example:
xyz.cs 'work item 1' 'C397'
xyz.cs 'work item 2' 'C399'
Eventually I have to then work out that work item 1 is dependant on work item 2. I also have to track back to work item 1 to check the status.
Can someone assist with a 2010 version script? I have never written PS before.
I needed the exact same thing and I wrote a TFS utility for myself, using TFS API. It allows you to see all changes a work item triggered over time, and some things more. I've put it on codeplex. You can get it from:
tfshelper.codeplex.com

Git merge from a specific folder only

I've created a rails website for client X. I now have a client, Y, who wants a website that does the exact same thing as client X, but with a different skin.
I made a git branch from clientXcode and called it clientYcode. I then did all the changes to the views to make it look different, and lala, the same website with a different skin.
Now here's what I don't understand about git: I've made many changes to clientXcode in the views, models, and controllers; and now I want to merge those changes into clientYcode, excluding any view changes. Since views, models, and controllers each have their own folder in rails I was hoping to be able to do something like:
git merge client_x_code 'app/controllers/*', 'app/models/*'
QUESTION 1: Is something like that possible with git? If so, how would I do it?
QUESTION 2: Was branching the best solution to make a copy of my project?
Well I found the easiest solution to my problem...
git checkout clientYcode
git checkout clientXcode "app/controllers/"
git checkout clientXcode "app/models/"
And that does what I want!
The simplest course of action is to merge everything, except the content of the directory you want to keep.
You can do that by adding a merge driver in that directory, as the How do I tell git to always select my local version for conflicted merges on a specific file? question details.
With that merge driver in place, Branching is a good solution in this case.
Extract:
We have a .gitattributes file defined in the dirWithCopyMerge directory (defined only in the branch where the merge will occurs: myBranch), and we have a .git\config file which now contains a merge driver.
[merge "keepMine"]
name = always keep mine during merge
driver = keepMine.sh %O %A %B

Get labels applied to a particular version of an item in TFS source control

I'm trying to get a list of labels that apply to a particular version of a particular file in TFS Source Control. So far, I've gotten a set of labels that apply to any version of a particular file. Does anyone have any experience getting labels for a particular item?
For example, I have $/Project/Folder/Item.cs, which was modified in changesets 301, 401, and 601. Labels Build1 - Build 99 exist for the project. Build1 - Build10 were applied before changeset 301 (i.e. before Item.cs was created). Build96 - Build99 were applied to the v601 of Item.cs. If I run
vcServer.QueryLabels(null, "$/Project", null, false, "$/Project/Folder/Item.cs", new ChangesetVersionSpec(6))
I get Build11 - Build99 as results. I haven't figured out how to get a query to return fewer than this many labels. Ideally, the query I run will return 4 labels (Build96 - Build 99).
The context of this question is a TFS Project, with CCNET for a build server. I'm trying to relate work items to builds, starting with a work item number.
Any tips? Or examples of QueryLabels? Or better docs for QueryLabels than the MSDN docs?
This is possible, see here: http://social.msdn.microsoft.com/Forums/en-US/tfsversioncontrol/thread/9f41f37e-4fda-4b56-91a3-f2b7e0c0e22d
Basically, once you get back the list of labels, you have to look through each label and see what changeset of the item you're interested in it applies to. Be sure to pass in the "includeItems = false" flag to QueryLabels, otherwise you'll have to look through every item on the label.
What you are wanting to do should definitely be possible using the API. The answer I gave to the other question was about seeing the labels inline with history in the UI.
For more information about doing what I think you are wanting to do, then take a look at:
Buck Hodges: Finding the changes between two labels in TFS version control
and also
Manish Agarwal: What is GenCheckinNotesUpdateWorkitem task?
Hope that helps.
Martin.
It looks like it's not possible with the current TFS version, but may be with the next.

Resources