protected void OnInit()
        {
            BazaarVersionControl bvc    = null;
            BazaarRepository     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 BazaarVersionControl)
                {
                    bvc = (BazaarVersionControl)vcs;
                }
            }

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

            bvc.Init(path);

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

            repo.Add(addFiles.ToArray(), false, null);
            solution.NeedsReload = true;
        }
        /// <summary>
        /// Performs a bzr branch
        /// </summary>
        /// <param name="location">
        /// A <see cref="System.String"/>: The from location
        /// </param>
        /// <param name="localPath">
        /// A <see cref="System.String"/>: The to location
        /// </param>
        /// <param name="monitor">
        /// A <see cref="IProgressMonitor"/>: The progress monitor to be used
        /// </param>
        private static void DoBranch(string location, string localPath, IProgressMonitor monitor)
        {
            BazaarVersionControl bvc = null;

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

            if (null == bvc || !bvc.IsInstalled)
            {
                throw new Exception("Bazaar is not installed");
            }

            // Branch
            bvc.Branch(location, localPath, monitor);

            // Search for solution/project file in local branch;
            // open if found
            string[] list = System.IO.Directory.GetFiles(localPath);

            ProjectCheck[] checks =
            {
                delegate(string path)
                {
                    return(path.EndsWith(".mds"));
                },
                delegate(string path)
                {
                    return(path.EndsWith(".mdp"));
                },
                MonoDevelop.Projects.Services.ProjectService.IsWorkspaceItemFile
            };

            foreach (ProjectCheck check in checks)
            {
                foreach (string file in list)
                {
                    if (check(file))
                    {
                        Gtk.Application.Invoke(delegate(object o, EventArgs ea)
                        {
                            IdeApp.Workspace.OpenWorkspaceItem(file);
                        });
                        return;
                    }    // found a project file
                }        // on each file
            }            // run check
        }
        protected override void Update(CommandInfo info)
        {
            BazaarVersionControl bvc = null;

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

            info.Visible = (null != bvc && bvc.IsInstalled);
        }
Exemplo n.º 4
0
 public BazaarRepository(BazaarVersionControl vcs, string url)
     : base(vcs)
 {
     Init();
     Url = url;
 }
 public BazaarRepository(BazaarVersionControl vcs, string url)
     : base(vcs)
 {
     Init();
     Url = url;
 }