TF203071: Cannot branch anymore after the migration to TFS 2010

by Ewald Hofman 19. September 2010 23:37

After we have migrated our TFS 2008 servers to TFS 2010, some teams had trouble with creating their branches. They were sure that they were able to create the branches in TFS 2008. They received the following error message.

clip_image002

Diving deeper into the problem, I found out that on that path a Branch folder was created.

clip_image002[6]

A question to the product team gave the following hint:

We have introduced the concept of “branches” as first class entities in 2010. Since we didn’t have this concept in 2008, the upgrade tries to detect your branch roots by using a heuristic, it can go wrong in cases. In those cases you need to remove the incorrect branch roots using the method specified below and specify the correct branch root.

You can resolve the issue by converting the branch folder to a normal folder. You can find this command in the menu of Visual Studio: File -> Source Control -> Branching and Merging -> Convert to Folder

Tags:

VSTS 2010 | Version Control

Change the file masks that are excluded by Source Control

by Ewald Hofman 2. August 2009 22:32

When you add files to Source Control, some of the files are excluded automatically, such as dll files.

 

You can change the default setting by modifying one of the following registry keys:

Per-User: HKCU\Software\Microsoft\VisualStudio\<version>\TeamFoundation\SourceControl\AddOptions
Per-Machine: HKLM\Software\Microsoft\VisualStudio\<version>\TeamFoundation\SourceControl\AddOptions

where <version> is the VS version:
For TFS2008 “9.0”
For TFS2010 "10.0"
 
If the value is not already there, add a string value titled “ExcludeMasks” and set it to the exclusion list you would like to use.  If this value if found, it overrides the built-in defaults.

 

Tags:

Version Control | VSTS 2008 | VSTS 2010

Remove ***NO_CI*** changesets from merge candidates

by Ewald Hofman 26. July 2009 23:34

A common scenario when you use TFS and Team Build, is that you want to update your build number during that process. There is the AssemblyInfoTask to accomplish that, but the downside of this approach is that it will create an extra changeset on every build. When you use a braching strategy, then it makes the merge process harder because there are these polluting ***NO_CI*** changesets.

Fortunately there is the possibility to discard these changeset from the merge candidate list. The application that is shown below let you remove those changesets automatically.

using System;
using System.Diagnostics;
using System.IO;
using Microsoft.TeamFoundation.Client;
using Microsoft.TeamFoundation.VersionControl.Client;
 
namespace ConsoleApplication1
{
    internal class Program
    {
        private static void Main(string[] args)
        {
            if (args.Length != 3)
            {
                Console.WriteLine(AppUsage());
                return;
            }
 
            const string tf = @"c:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\tf.exe";
            string tfsServer = args[0];
            string sourcePath = args[1];
            string targetPath = args[2];
 
            // Get a reference to our Team Foundation Server.           
            var tfs = new TeamFoundationServer(tfsServer);
 
            // Get a local path for the Tfs server. This is required by the TF command.
            string localPath = GetFirstLocalFolder(tfs);
 
            // Iterate through all merge candidates
            foreach (MergeCandidate candidate in GetMergeCandidates(tfs, sourcePath, targetPath))
            {
                // Skip all changesets that are not commented with ***NO_CI***
                if (candidate.Changeset.Comment != "***NO_CI***")
                    continue;
 
                // Discard the ***NO_CI changeset from the merge candidates
                Console.WriteLine(Execute(tf, localPath,
                                          string.Format("merge /discard /recursive /version:C{0} \"{1}\" \"{2}\"",
                                                        candidate.Changeset.ChangesetId, sourcePath, targetPath)));
                Console.WriteLine(Execute(tf, localPath,
                                          string.Format(
                                              "checkin /recursive /noprompt /comment:\"***NO_CI***\" /override:\"Discard the ***NO_CI*** changeset from the merge candidates.\" \"{2}\"",
                                              candidate.Changeset.ChangesetId, sourcePath, targetPath)));
            }
        }
 
        /// <summary>
        /// Displays how the app should be used.
        /// </summary>
        private static string AppUsage()
        {
            return "Start the application with 3 arguments: " + Environment.NewLine +
                   @"- The url of the Tfs Server (eg http:\\MyServer:8080" + Environment.NewLine +
                   @"- The path of the source branch (eg $/MyTeamProject/MySourceBranch)" + Environment.NewLine +
                   @"- The path of the target branch (eg $/MyTeamProject/MyTargetBranch)";
        }
 
        /// <summary>
        /// Returns the list of all merge candidates.
        /// </summary>
        private static MergeCandidate[] GetMergeCandidates(TeamFoundationServer tfs, string sourcePath,
                                                           string targetPath)
        {
            var versionControl = (VersionControlServer) tfs.GetService(typeof (VersionControlServer));
            return versionControl.GetMergeCandidates(sourcePath, targetPath,
                                                     RecursionType.Full);
        }
 
        /// <summary>
        /// Returns the local path of the first workspace.
        /// </summary>
        private static string GetFirstLocalFolder(TeamFoundationServer tfs)
        {
            var versionControl = (VersionControlServer) tfs.GetService(typeof (VersionControlServer));
            Workspace[] workspaces = versionControl.QueryWorkspaces(null, null, Environment.MachineName);
 
            return (workspaces.Length > 0 && workspaces[0].Folders.Length > 0)
                       ? workspaces[0].Folders[0].LocalItem
                       : null;
        }
 
        /// <summary>
        /// Runs the TF command
        /// </summary>
        private static string Execute(string fileName, string localPath, string arguments)
        {
            var pi = new ProcessStartInfo
                         {
                             FileName = fileName,
                             Arguments = arguments,
                             UseShellExecute = false,
                             ErrorDialog = false,
                             CreateNoWindow = true,
                             RedirectStandardOutput = true,
                             WorkingDirectory = localPath
                         };
 
            Process p = Process.Start(pi);
 
            // Read the redirected output.
            using (StreamReader sr = p.StandardOutput)
            {
                return sr.ReadToEnd();
            }
        }
    }
}

Tags: , ,

Team Build | Version Control | VSTS 2008

Recover security settings

by Ewald Hofman 3. July 2009 02:05

It is possible in Version Control to override the security settings per folder. To do that uncheck the "Inherit security settings" and you can add, modify and remove the permission.

When you accidently remove all accounts from the list, then it is not possible to view the contents of the folder for any user, nor change the security settings. This is even the case for a Server Administrator.

To recover from this situation, you have to access Version Control with the TFSSETUP service account.

Tags: , , ,

Version Control | VSTS 2008

Powered by BlogEngine.NET 1.6.1.0
Theme by Mads Kristensen


ClusterMap

Statistics

Statistics created at 09 Sep 2009

121 posts
493 comments
328 raters
1951511 visit (1042 per day)
12 users online

Recent comments

Comment RSS