예제 #1
0
        protected override void Run()
        {
            SelectRepositoryDialog del = new SelectRepositoryDialog(SelectRepositoryMode.Checkout);

            try {
                if (MessageService.RunCustomDialog(del) == (int)Gtk.ResponseType.Ok && del.Repository != null)
                {
                    CheckoutWorker w = new CheckoutWorker(del.Repository, del.TargetPath);
                    w.StartAsync();
                }
            } finally {
                del.Destroy();
                del.Dispose();
            }
        }
예제 #2
0
        public static bool Publish(IWorkspaceObject entry, FilePath localPath, bool test)
        {
            if (test)
            {
                return(VersionControlService.CheckVersionControlInstalled() && VersionControlService.GetRepository(entry) == null);
            }

            List <FilePath> files = new List <FilePath> ();

            // Build the list of files to be checked in
            string moduleName = entry.Name;

            if (localPath == entry.BaseDirectory)
            {
                GetFiles(files, entry);
            }
            else if (entry is Project)
            {
                foreach (ProjectFile file in ((Project)entry).Files.GetFilesInPath(localPath))
                {
                    if (file.Subtype != Subtype.Directory)
                    {
                        files.Add(file.FilePath);
                    }
                }
            }
            else
            {
                return(false);
            }

            if (files.Count == 0)
            {
                return(false);
            }

            SelectRepositoryDialog dlg = new SelectRepositoryDialog(SelectRepositoryMode.Publish);

            try {
                dlg.ModuleName = moduleName;
                dlg.Message    = GettextCatalog.GetString("Initial check-in of module {0}", moduleName);
                do
                {
                    if (MessageService.RunCustomDialog(dlg) == (int)Gtk.ResponseType.Ok && dlg.Repository != null)
                    {
                        AlertButton publishButton = new AlertButton("_Publish");
                        if (MessageService.AskQuestion(GettextCatalog.GetString("Are you sure you want to publish the project?"), GettextCatalog.GetString("The project will be published to the repository '{0}', module '{1}'.", dlg.Repository.Name, dlg.ModuleName), AlertButton.Cancel, publishButton) == publishButton)
                        {
                            PublishWorker w = new PublishWorker(dlg.Repository, dlg.ModuleName, localPath, files.ToArray(), dlg.Message);
                            w.Start();
                            break;
                        }
                    }
                    else
                    {
                        break;
                    }
                } while (true);
            } finally {
                dlg.Destroy();
                dlg.Dispose();
            }
            return(true);
        }