I have a gated checkin build which does change some files of the changeset which is provided by the user requesting the build. The build does mainly set the build version number in the source files for all targets.
The gated checkin activity does checkin the shelveset of the user. Now I want to checkin also the changed files by my build which can potentialy conflict with files part of the users shelvset. This results in merge conflicts.
Is use VersionControlServer.CheckinShelveset which has no options to force a checkin in case of merge conflicts due to the other checkin of the previous shelveset. I tried to change the shelveset provided by the user but I cannot change a shelveset which was not created by the same user. I am forced therefore to create a second shelveset and wait until the gated checkin activity which lives on the build controler has succeeded.
When I have a workspace I could resolve the changes but on the build controler there is no workspace (it is on the build agent) so I would have to create a new workspace, unshelve the shelveset of the other user and try to merge my other shelveset into this one and then try to checkin which is not easy and more seriously it would take quite some time.
Is there a way to checkin a shelveset in and force TFS to simply overwrite the latest version without having a workspace? Or is there another way to get my changes of the build checked in without merge conflicts? If I would check earlier on the build agent then the gated checin will fail with merge conflicts on the build controler.
If you have your code that does this run on the build agent rather than the controller, you would have access to the workspace. In that case, you could consider having two checkins: the first is the user's changes, and the second would be the modifications your code made. Or, you could simply make the changes to the code and then do the checkin from the workspace of the build agent. In that case, the shelveset submitted by the user would not be used for the checkin but as the basis for your code to make further changes and then check that in.
There's no way to force a shelveset to be checked in despite conflicts.
Related
We'd like to have a process like the following:
User submits code review with shelveset of changes they want to be in master branch.
If code passes review, select group of users can pull down the shelveset, and merge the changes into master using the original authors name for historical tracking.
I can use the tf checkin /author:{OriginalAuthor} command, but this doesn't work with our gated build. If I bypass the gated build, it will check in on the original authors behalf, but using the gated build it seems to pull the Author from the shelveset which is still marked as coming from my account/workspace and not the /author.
So I'm wondering, is there a way to have the gated build honor the /author argument for the final check-in that it performs?
I just tested in TFS 2015.3, and enable a Gated Check-in in new build system.
If I use tf checkin /author:A, I'll get a shelveset with message below:
Your check-in has been placed into shelveset
Gated_2016-10-27_01.53.28.8457;B and submitted for validation by build
definition \ScrumProject\Visual Studio.
Once user B request a review, user A re-run command tf checkin /author:A, you'll see the message below, and the change has been checked in by user A.
I'm trying to apply a shelveset from a branch to another, following these steps:
http://benjii.me/2014/04/move-shelveset-to-different-branch-in-tfs/
But when TFS opens a screen for me to resolve conflicts, it's impossible to work, because my shelveset has more than 700 files. I can't specify the desired merge option for each one.
What I need is to specify a default merge action for all the unresolved conflicted files at once.
Is it possible? If so, how can we do it?
Unfortunately there's no way to do so through power tools. When you are moving a shelveset of multiple files between branches, you must need to resolve the conflicts produced manually.
However there is another way to move a shelveset to another branch.
Please see the answer from Simon_Weaver Can I unshelve to a different branch in tfs 2008?
Suppose you realized that you forgot to checkin just one file during a tfs checkin.
Is there a way to rollback the checkin, have the changes that were part of it show up as pending changes and just add the incremental file change. And then just check everything back in.
The reason for my weird request is as follows.
Suppose you do two separate checkins. But those checkins are not successive checkins in the folder/solutions history.
Then when i need to merge just my changes to parent branches, I need to do separate merges for each checkin in the child branch.
Annoyingly tfs doesnt allow non-contiguous checkin. And if the parents branches are gated ie they build each time after checkin, it can mean a wait time of 10 minutes per changeset/checkin. Aarghhhhhhhhhh
Rollback the original changeset
Checkin
Rollback the rollback
Add in the change you forgot the first time
Checkin
I have following situation:
I have created some new projects in solution in one development branch in TFS
I'm now merging them into the main branch.
Architect has idea to merge two new modules into one.
I have moved the code files
Project files has already been changed within the merge.
These files have pending changes in form merge, branch, edit. I wan't to make this file merge, branch, delete but TFS won't do that because the file has pending changes. Is it possible to force the deletion or undo edit without undoing merge, branch?
I don't want to try the merge again and combine files from two shelvesets... Is there any possibility to modify the status of pending changes?
No, TFS does not support that.
You could "undo" the file and just pend a delete instead.
As best practice you shouldn't be making changes as part of a merge, you should just do the minimum possible to resolve the conflicts and get it to build (or not even that sometimes) and then make your required changes in a subsequent check-in. This makes it easier to see in the version control history what changes were made when - I very rarely look to see if a merge of a change is any different from a prior edit.
I'm a developer and I've made some changes to a solution, which I have saved off to a shelveset. Another developer unshelves my changes and builds the solution on a server. Is there a way for the second developer to check in my shelveset? I know he/she can check in the individual files comprising the shelveset. However, I was thinking of a "checkin" command that took the name of a shelveset as a parameter, or if there was another way to check in those changes as a unit, with the shelveset name.
The other developer can open a Visual Studio Command Prompt and use the following command:
tf checkin /shelveset:shelvesetname;shelvesetowner
See Checkin Command on MSDN for more details.
I don't think check-in via TFS Command Line directly is a better way, it maybe conflict with the latest code on TFS.
I think the better way to check in shelveset if there are some another changes in you code, but you don't check in it, is create a new WorkSpace in your local computer
Then map the latest code to the new workspace, then unshelve(download) the shelveset, resolve the conflict if necessary, then check in the code
For those having issues with the error:"Items cannot be specified with the /shelveset option.", try putting the user name in parenthesis as follows:
tf checkin /shelveset:shelvesetname;"shelvesetowner"
An easy way to do this is to define a new workspace and have the developer unshelve to that workspace. Then, all of the pending changes for that workspace correspond to the shelfset, and they can check in everything in the workspace.
The second developer can go to Team Explorer -> Builds and right click on the Build definition you are working with.
Select “Queue New Build…”
In the combobox “What do you want to build?”, select “Latest sources with shelveset”.
If you go to the button “…” you can select any shelveset from anyone.
Then check the box “Check in changes after successful build”.
A build runs with that shelveset, the shelveset is checked in when the build passes.