Exemple #1
0
        protected override megahistorylib.Revision _construct(string branch, Changeset cs)
        {
            Revision rev = new Revision(branch, cs);

            /* want to have a single list of branches, this ensures that. */
            lock (_branches)
            {
                branch = tfsinterface.Utils.GetEGSBranch(branch);
                BranchCont.iterator it = _branches.find(branch);

                if (it != _branches.end())
                {
                    /* see if the branches are really exactly the same */
                    if (it.item() != branch)
                    {
                        branch = it.item();
                    }
                }
                else
                {
                    _branches.insert(branch);
                }
            }

            return(rev);
        }
Exemple #2
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);
        }