At the moment, from what I know, if you have two branches, you have to have both branches mapped to locations on your machine and Visual Studio (or TFS within Visual Studio) will download the latest version and merge the changes locally and then you have to check in the other branch. I would like to be able to merge this branch with this branch with only having one branch mapped locally?
The purpose of this is that we have a development branch, a test branch and a release branch and we are merging changes from the development branch into the test branch and building it on the server which is then deploying it on another server. All this is working great but the test (and release) branch must be mapped on the machine of anyone trying to do this otherwise it won't work.
Ideally I'd like to be able to log into Visual Studio Online and do all the merges, builds and deployments there rather than on my development machine at all - is any of this possible? And if so, how please?
Not entirely sure this is something support-able by the TFS product, actually. Merges tend to need at least a minimal amount of human interaction whenever there is conflicts (and even in the cleanest merge relationships conflicts can and do arise).
However, you can do this on the build machines if you wish by performing the merge just before the build occurs and if the build succeeds, checking the merged changeset in.
Using the Pre- and Post- build script functionality in TFS build, you could try to do something such as the following...
Pre-build script would include commands such as:
tf merge $/ProjectRoot/Branches/Dev $/ProjectRoot/Branches/Test
tf resolve $/ProjectRoot/Branches/Test /r /i /auto:TakeTheirs
Post-build script would include:
tf checkin $/ProjectRoot/Branches/Test /r /i /comment:"***NO_CI*** [AutoMerge]"
Related
I'm trying to deploy a Continuous Integration server where I work.
We used TFVC with the branch to release strategy, but we are having difficulty with something that should be trivial.
We only need the build on the branch that was checked in.
Is it possible to do this without having to change the build definition every time a new branch is created?
I do not want to map the entire folder structure of the repository. Imagine having 10 branches and every check-in, build all? Does not make sense!
Anyone have any idea how to do it?
The CI build for TFVC can’t map and just build target branch like build for Git.
There are some workarounds:
Clone a build definition and change source mapping, Path filters of triggers for each branch.
Add a PowerShell step/task to get recent check-in change by calling get changesets Rest API, then store the related solution/project files in a variable by using Logging Commands, then build these solutions/projects
I downloaded Team Server Power Tools (TFPT) to be able to take a shelveset that was created on one branch and unshelve it on another. But for some reason, TFPT insists on asking for the target server path, which I find a bit ridiculous since it should be visible to TFPT.
A quick look around, it appears that there is an API that will state the server path, but I would rather have this available through scripting. Is there a way to get the server path through scripting?
If you have a shelveset called MyChanges on the Main branch in a Team Project called MyProject and you want to unshelve it to the Dev branch instead then the tfpt command would be:
tfpt.exe unshelve /migrate /source:"$/MyProject/Main" /target:"$/MyProject/Dev" "MyChanges"
I use TFS with Jira to managment my team tasks.
I want to integrate a Code Review tool at development process.
When i try to use crucible i reveal that it not support TFS.
I want to know if , there is a good and credible solution for this ,to enable me use crucible with TFS.
additional , if there are another suggests for code reiview tool for VS and JIRA.
Thank!
Some time ago we decided to run Crucible on our project. Our project uses TFS 2012. We use one branch in TFS called 'dev' as a trunk, i.e. branch where developers make commits and where raw code located. Second branch where release code located called 'main'
Our workflow for peer review was:
Make some changes and shelve code
Send email to reviewer
Reviewer doing review in some custom tool and send email with notification that he is done
Commit code into 'dev' branch on TFS
Wait while build-server makes successful build
Commit to 'main' branch where production code resides
Our goal was to improve step 2 and 3. Crucible is great tool, but it doesn't support TFS out of the box, thus we decided to use some TFS bridge. Actually, there are two main options either using tfs->svn or tfs->git. Finally, we decided to use tfs->git bridge, because creating branches in git extremely cheap and it might have been helpful (it did), because we was thinking use branches in git for out shelvesets in TFS. Finally we made our mind to use git.
So far I know only 2 options to convert TFS into git:
git tf - this one works on Linux and recommended by Microsoft
git tfs - this one works only under Windows, but we choose this one, because of large set of commands
We need to convert TFS branch into Git repo and maintain our git repository in fresh state. We don't work with git to push new changes back into TFS, we need git repo only for Crucible.
There are steps we made to achieve the goal:
1. Firstly, we cloned our TFS "dev" branch into "dev" repo. We needed only this one branch, and we haven't any back merges from "main" branch. We have tried to do this with clone command, but without any luck:
git tfs clone http://tfs:8080/tfs/DefaultCollection $/SOME_PATH/dev
This command cloning full history from TFS, but it seems our TFS branch quite large and at some time git-tfs crashed with System.OutOfMemoryException exception. Another time, we failed with exception that max limit of path was exceeded, we found workaround by mapping workspace dir into as short path as possible as follows:
git config --global git-tfs.workspace-dir e:\ws
When we failed with clone command, we went to use quick-clone command. This one cloning starting from any time in history, from any changeset.
git tfs quick-clone -c545532 http://tfs:8080/tfs/DefaultCollection $/SOME_PATH/dev
Option -c545532 here is the number of changeset to starting copying from. Once per year we update all our source files with new header, thus we just to copy from beginning of current year. In that way we should have all necessary history to make branches from shelvesets.
If you hadn't used -c argument here, you would have haven't any history at all, because quick-clone copies just history if you asking for it.
Once repository was cloned, we had written "script" and put it into task scheduler to run every 5 min. What script is doing is just checking for new commits in TFS and creates new branches on our git repository. Again, we use git-tfs here. To get all new commits we call pull command:
git tfs pull
To unshelve TFS shelveset into particular git branch we use unshelve command:
git tfs unshelve -user=TFSDOMAIN\Username "Shelveset Name Here" Branch_Shelveset_Name_Here
This last command creates branch 'Branch_Shelveset_Name_Here' in git from shelveset 'Shelveset Name Here' in TFS. A shelveset's name can contains spaces and some escape chars, so our "script" clean up such cases. As I said, creating branches very cheap on git, thus we haven't any problems with this. If something was pushed into git repo we call crucible API to refresh it.
BTW: To make git repo visible in network I just installed SCM-Server. Crucible was installed and configured to use our domain username/password, thus we get email notification as well. As result we drastically improved step 2 and 3 from our workflow and it works for few months and we are happy with it.
Our workflow became:
Make some changes and shelve code
Wait for our shelveset in crucible (about 6-8 min), create review
Reviewer doing review in crucible
Commit code into 'dev' branch on TFS
Wait while build-server makes successful build
Commit to 'main' branch where production code resides
While working with this I noticed few issues:
Issue1: If you added new file into project and shelved it, you would not see it in git repo, because git-tfs can't find parent commit for it. I'm not sure is it bug of this tool or not, but simplest workaround for this, is having at least one file in shelveset with existing parent. For example, you have added 2 new files and want to send it for review. Instead of creating shelveset with these files, just touch any file which already in git repo (make it pending in Visual Studio), finally you will be able create shelveset with three files (2 new files [add] and 1 for edit [edit]). In that case everything works and git-tfs can unshelve TFS' shelveset into git branch., i.e. we can see it in crucible.
Issue2: One day our HEAD in git repo became detached from "master" branch. Once that happened crucible didn't see new changesets. I have fixed it with command:
git rebase HEAD master
I have created picture how this everything works on our project, may be it could be helpful:
You can integrate Mira and TFS with TaskTop and then use the code review tools built into Visual Studio.
Code Review added in Visual Studio 2012
TaskTop integration with TFS & Jira
These I think are your best options.
I'm looking at using TeamCity 7.1 as our build server, and I am trying to figure out if it is possible to do what I want.
Our TFS branching looks like this
MyProject
tags
1.0.0.0
1.1.0.0
2.0.0.0
trunk
So our process is to work in the trunk, and when we reach a point where we want to deploy, then we create a branch with that code. In the above example, version 2.0.0.0 is in production, and the trunk has further changes made to it. So if I need to fix a bug in production, then I will fix it in the 2.0.0.0 branch.
I am able to set up a build that checks out the trunk, runs tests, etc., without any problems, and it can be triggered by checkins to the trunk. But I would like to also monitor all the version specific branches, so that when I check in a bugfix in the 2.0.0.0 branch, then a build is triggered, and all my tests are run.
It seems that some of the VCS options have had a new feature added to support this called "branch specification" (https://tom.cabanski.com/2012/11/19/teamcity-7-1-branch-builds-rock/) but that is not available on a TFS VCS root.
Is it possible to do this without creating a separate build configuration for each of my version branches? Or is there a way to manually launch a build of a specific branch, by using my existing build configuration for the trunk?
Since "feature branches" are not supported for TFS in TeamCity (only for Git and Mercurial at this time), creating separate build configurations is the best way to build separate branches. Actually, even for Git and Mercurial creating separate build configurations for long-lived version branches (as opposed to feature branches which come and go) is recommended.
I am not sure how branches are handled in TFS, but if you use tags, I believe there is no way to build off a TFS tag in TeamCity (TW-7370).
We have a TFS 2005 (I think) were we host some code in one domain. Now we would like the customer do host the code by itself and they have bought a new version of TFS 2010. How do I migrate the code from the old server to the new one. We don't care about history at this point since we will have the old system running for at least one year if something critical happen.
What I have done so far is the following:
Create a master branch in the new version and copied the old version to the new version with no problem.
Created a development branch from the master branch.
Now I would like to migrate the development code from the old tfs to the new tfs and this seems complicated.
I first thought it would be as simple as checking out the whole development branch in the new TFS, delete all the files and just paste in the files from the old development branch. But that is not the case.
Maybe there are a simple tool I could use instead?
I know you said that you don't care about history but would you take it if you could get it for free? The best thing to do here is an upgrade, or an import of a Team Project Collection. If you take backups of all of your 2005 databases and restore them on the TFS 2010 data tier you can then run "tfsconfig.exe import". This is the most supported way to get your data from one server to the other.
Follow these steps in the new server:
Create the Master Branch, check-in.
Copy the sources from the old server in the local workspace of the new server at the Master Branch location
Check-in to commit the sources to the new server.
Create the Dev branch from the Master Branch using the latest changeset of the Master branch. This will replicate the whole structure of the Master branch to the Dev one.
Exit Visual Studio
Using the Windows Explorer, delete all the content of the Dev branch in the local workspace of your new server.
Copy the sources from the old server of the Dev branch in the local workspace of the new server at the Dev branch location.
Use the TFPT.EXE ONLINE command of the Team Foundation Power Tools to simulate an offline/online switch that will create the pending changes of the new content of your Dev branch (the files you copied from the old server). Be careful you have everything the way you want it to be in TFS. The command is something like tfpt.exe online /adds /deletes /modify /recurse . (check the help of the command)
Check-in.
Then you'll have the relationship between both branch and the content you want in both.
Have a look at TFS Integration Platform