示例#1
0
        private static void UpdateSource(string parent, string source)
        {
            string url      = PathConverter.ConvertPathToUrl(source, baseUrl, workspace);
            string nodeType = GetNodeType(url);

            if (nodeType == "file")
            {
                UpdateToReference(url);
                string r = PathConverter.ConvertUrlToPath(url, baseUrl, workspace);
                AddToGatheredRefsList(parent, r);
                FileInfo fi = new FileInfo(r);
                if (fi.Extension.EndsWith("proj"))
                {
                    List <string> refList = ProjFileOps.GetReferences(fi, fi.DirectoryName);
                    foreach (string f in refList)
                    {
                        UpdateSource(fi.FullName, f);
                    }
                }
            }
            else
            {
                string r = PathConverter.ConvertUrlToPath(url, baseUrl, workspace);
                gatheredRefs.Add(r, parent);
                UpdateToReference(url);
            }
        }
示例#2
0
        private static void AddReferencesToDatabase()
        {
            //bool inDb = false;
            //try
            //{
            //    using (BT_SemiAutoEntities de = new BT_SemiAutoEntities())
            //    {
            //        de.Builds.Add(currentBuild);
            //        de.SaveChanges();
            //        inDb = true;
            //    }
            //}
            //catch
            //{
            //    inDb = false;
            //}

            //if (inDb == true)
            //{
            Console.ForegroundColor = infoColor;
            Echo("Adding references for this build to the database...");
            Echo();
            //}

            foreach (string r in gatheredRefs.Keys)
            {
                string rev = GetRevision(r);
                string url = PathConverter.ConvertPathToUrl(r, baseUrl, workspace);
                //BuildSource bs = new BuildSource();
                //bs.BuildId = currentBuild.Id;
                //bs.RepositoryType = "svn";
                //bs.Revision = rev;
                //bs.Url = url;
                //bs.ReferencedBy = gatheredRefs[r];

                using (BuildWellWCF.BuildWellWCFClient client = new BuildWellWCF.BuildWellWCFClient())
                {
                    client.AddBuildReference((int)buildId, gatheredRefs[r], "svn", rev, url);
                }

                //bi.SourceCodeRevision += bs.Revision + " " + bs.Url + " Reference By: " + bs.ReferencedBy + "\n\r";

                //if (inDb == true)
                //{
                //    using (BT_SemiAutoEntities de = new BT_SemiAutoEntities())
                //    {
                //        de.BuildSources.Add(bs);
                //        de.SaveChanges();
                //    }
                //}
            }

            Echo();
            Console.ForegroundColor = oColor;
        }