Exemplo n.º 1
0
        protected void OnInit()
        {
            MercurialVersionControl bvc    = null;
            MercurialRepository     repo   = null;
            VersionControlItem      vcitem = GetItems()[0];
            string          path           = vcitem.Path;
            List <FilePath> addFiles       = null;
            Solution        solution       = (Solution)vcitem.WorkspaceObject;

            foreach (VersionControlSystem vcs in VersionControlService.GetVersionControlSystems())
            {
                if (vcs is MercurialVersionControl)
                {
                    bvc = (MercurialVersionControl)vcs;
                }
            }

            if (null == bvc || !bvc.IsInstalled)
            {
                throw new Exception("Can't use mercurial");
            }

            bvc.Init(path);

            repo     = new MercurialRepository(bvc, string.Format("file://{0}", path));
            addFiles = GetAllFiles(solution);

            repo.Add(addFiles.ToArray(), false, null);
            solution.NeedsReload = true;
        }        // OnInit