2
using System.Collections;
4
using MonoDevelop.Projects;
5
using MonoDevelop.Core;
6
using MonoDevelop.Ide.Gui;
8
using MonoDevelop.VersionControl.Dialogs;
10
namespace MonoDevelop.VersionControl
12
internal class PublishCommand
14
public static bool Publish (CombineEntry entry, string localPath, bool test)
19
if (!VersionControlService.CheckVersionControlInstalled ())
22
ArrayList files = new ArrayList ();
24
// Build the list of files to be checked in
25
string moduleName = entry.Name;
26
if (localPath == entry.BaseDirectory) {
27
GetFiles (files, entry);
28
} else if (entry is Project) {
29
foreach (ProjectFile file in ((Project)entry).ProjectFiles.GetFilesInPath (localPath))
30
if (file.Subtype != Subtype.Directory)
31
files.Add (file.FilePath);
35
SelectRepositoryDialog dlg = new SelectRepositoryDialog (SelectRepositoryMode.Publish);
37
dlg.ModuleName = moduleName;
38
dlg.Message = GettextCatalog.GetString ("Initial check-in of module {0}", moduleName);
40
if (dlg.Run () == (int) Gtk.ResponseType.Ok && dlg.Repository != null) {
41
if (IdeApp.Services.MessageService.AskQuestion (GettextCatalog.GetString ("Are you sure you want to publish the project to the repository '{0}'?", dlg.Repository.Name))) {
42
PublishWorker w = new PublishWorker (dlg.Repository, dlg.ModuleName, localPath, (string[]) files.ToArray (typeof(string)), dlg.Message);
55
static void GetFiles (ArrayList files, CombineEntry entry)
57
files.Add (entry.FileName);
58
if (entry is Project) {
59
foreach (ProjectFile file in ((Project)entry).ProjectFiles)
60
if (file.Subtype != Subtype.Directory)
61
files.Add (file.FilePath);
62
} else if (entry is Combine) {
63
foreach (CombineEntry e in ((Combine)entry).Entries)
68
public static bool CanPublish (Repository vc, string path, bool isDir) {
69
if (!vc.IsVersioned (path) && isDir)
75
internal class PublishWorker : Task {
82
public PublishWorker (Repository vc, string moduleName, string localPath, string[] files, string message)
85
this.path = localPath;
86
this.moduleName = moduleName;
88
this.message = message;
91
protected override string GetDescription ()
93
return "Publishing \"" + moduleName + "\" Project...";
96
protected override void Run ()
98
vc.Publish (moduleName, path, files, message, GetProgressMonitor ());
100
Gtk.Application.Invoke (delegate {
101
VersionControlService.NotifyFileStatusChanged (vc, path, true);