示例#1
0
        public override string[] branches()
        {
            string[]   bs          = null;
            BranchCont brs         = new BranchCont();
            ItemDict   branchItems =
                megahistory.SCMUtils.GetBranches(_vcs,
                                                 "$/IGT_0803/main/EGS/", VersionSpec.Latest);

            /* throw the tfs branches into the branch container. */
            for (ItemDict.iterator it = branchItems.begin();
                 it != branchItems.end();
                 ++it)
            {
                string full_branch      = it.value().ServerItem + "/";
                BranchCont.iterator bit = brs.find(full_branch);
                if (bit == brs.end())
                {
                    brs.insert(full_branch);
                }
            }

            if (_cache.BranchNames.Any())
            {
                bs = _cache.BranchNames.ToArray();

                foreach (string str in bs)
                {
                    BranchCont.iterator bit = brs.find(str);
                    if (bit == brs.end())
                    {
                        brs.insert(str);
                    }
                    else
                    {
                        if (bit.item() != str)
                        {
                            /* well shit. tfs screwed up.
                             * correct tfs.
                             */
                            string tmp = bit.item();

                            bit = null;
                            /* this call will invalidate the iterator. */
                            brs.remove(tmp);
                            brs.insert(str);
                        }
                    }
                }
            }

            if (brs.size() > 0)
            {
                bs = new string[brs.size()];
                int i = 0;
                foreach (string str in brs)
                {
                    bs[i] = str;
                    ++i;
                }
            }
            else
            {
                /* this code should never run. */
                bs = TFSDB.DefaultBranches();
            }

            return(bs);
        }