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

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.

Related

Is it possible to compare files using Plastic SCM Command Line 'cm diff' function?

I'd like to compare two files at particular changesets to see if they are identical or not.
Something like:
>> cm diff rev:Folder\MyFile.py#cs:5 rev:Folder\MyFile.py#cs:10
<< True
I'm getting an error (can't find revision of file I specify) and I think I might not be using diff as it's intended. I've worked around my confusion by using getfile on the particular file and changesets I'm comparing and using a python library file compare.
Thanks.
The Plastic SCM default diff tool will open a GUI showing you the file differences.
But you can manually configure a different one (eg. diff.exe) manually editing the "/home/user/.plastic/client.conf" or using the Plastic SCM GUI:
<DiffToolData>
<FileType>enTextFile</FileType>
<FileExtensions>*</FileExtensions>
<Tools>
<string>diff.exe #sourcefile #destinationfile</string>
</Tools>
</DiffToolData>
This way, you can run diffs through the command line and based on the output, determine if the files are identical or not.
You can use cm patch command
reference : https://blog.plasticscm.com/2018/11/unified-diff-of-branch.html

Merge separate projects into one solution and not loose the history in 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

Is it possible to combine two .po translation files together?

We have two .po files, each from different branches of a piece of software.
We need to combine these into a single .po file.
There are duplicates between the two files, and the ideal handling would be for one file's strings to be favoured (consistently).
We have a SUSE system so the --output-file doesn't seem to have the behaviour of ignoring/merging duplicates which the Sun version has according to a man page I found from a web search. (We do not have a Sun machine handy!)
What you are looking for is the msgcat util, it concatenates and merges the specified PO dictionaries.
This is part of gettext utils, for more information please consult gettext manual page on msgcat.
you can use poedit.
To merge your current po-file, you must to open it and click:
Catalog > Update from POT-file.
Set the filter to all files and select your second.po file
Poedit will show you new & obsolete strings
I use msgmerge:
msgmerge [old_file.po] [new_file.po] > output.po
It works for me, but be aware that it does a silly merge, it is, it discards the entries in the old_file (new file items overwrites old one items).

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