Esempio n. 1
1
		protected Revision (Repository repo, DateTime time, string author, string message)
		{
			this.repo = repo;
			this.Time = time;
			this.Author = author;
			this.Message = message;
		}
Esempio n. 2
0
			public CommitWorker (Repository vc, ChangeSet changeSet, CommitDialog dlg)
			{
				this.vc = vc;
				this.changeSet = changeSet;
				this.dlg = dlg;
				OperationType = VersionControlOperationType.Push;
			}
		public VersionControlItem (Repository repository, IWorkspaceObject workspaceObject, FilePath path, bool isDirectory)
		{
			this.path = path;
			this.repository = repository;
			this.workspaceObject = workspaceObject;
			this.isDirectory = isDirectory;
		}
Esempio n. 4
0
		public static void Commit (Repository vc, ChangeSet changeSet)
		{
			try {
				if (vc.GetVersionInfo (changeSet.BaseLocalPath).CanCommit) {
					if (!VersionControlService.NotifyPrepareCommit (vc, changeSet))
						return;

					CommitDialog dlg = new CommitDialog (changeSet);
					try {
						if (MessageService.RunCustomDialog (dlg) == (int) Gtk.ResponseType.Ok) {
							if (VersionControlService.NotifyBeforeCommit (vc, changeSet)) {
								new CommitWorker (vc, changeSet, dlg).Start();
								return;
							}
						}
						dlg.EndCommit (false);
					} finally {
						dlg.Destroy ();
					}
					VersionControlService.NotifyAfterCommit (vc, changeSet, false);
				}
			}
			catch (Exception ex) {
					MessageService.ShowException (ex, GettextCatalog.GetString ("Version control command failed."));
			}
		}
		protected override void ModifyPath (Repository repo, ref FilePath old)
		{
			var repo2 = (GitRepository)repo;
			old = repo2.RootRepository.Info.WorkingDirectory;
			repo2.RootRepository.Config.Set<string> ("user.name", Author);
			repo2.RootRepository.Config.Set<string> ("user.email", Email);
		}
		private static bool RevertRevisions (Repository vc, string path, Revision revision, bool test, bool toRevision)
		{
			try {
				if (test) {
					return (vc.CanRevert (path));
				}
				
				string question = GettextCatalog.GetString (
				  "Are you sure you want to revert the selected resources to the revision specified (all local changes will be discarded)?");
				
				if (!toRevision)
					question = GettextCatalog.GetString (
					  "Are you sure you want to revert the changes from the revision selected on these resources?");
				
				if (MessageService.AskQuestion (question, 
				                                GettextCatalog.GetString ("Note: The reversion will occur in your working copy, so you will still need to perform a commit to complete it."),
				                                AlertButton.Cancel, AlertButton.Revert) != AlertButton.Revert)
					return false;

				new RevertWorker(vc, path, revision, toRevision).Start();
				return true;
			}
			catch (Exception ex) {
				if (test)
					LoggingService.LogError (ex.ToString ());
				else
					MessageService.ShowException (ex, GettextCatalog.GetString ("Version control command failed."));
				return false;
			}
		}
Esempio n. 7
0
		public PublishWorker (Repository vc, string moduleName, FilePath localPath, FilePath[] files, string message) 
		{
			this.vc = vc;
			this.path = localPath;
			this.moduleName = moduleName;
			this.files = files;
			this.message = message;
		}
Esempio n. 8
0
		public VersionControlItem (Repository repository, IWorkspaceObject workspaceObject, FilePath path, bool isDirectory, VersionInfo versionInfo)
		{
			Path = path;
			Repository = repository;
			WorkspaceObject = workspaceObject;
			IsDirectory = isDirectory;
			this.versionInfo = versionInfo;
		}
		public static bool CanPublish (Repository vc, string path, bool isDir) {
			if (!VersionControlService.CheckVersionControlInstalled ())
				return false;

			if (!vc.GetVersionInfo (path).IsVersioned && isDir) 
				return true;
			return false;
		}
Esempio n. 10
0
		protected Revision (Repository repo, DateTime time, string author, string message, RevisionPath[] changedFiles)
		{
			this.repo = repo;
			this.time = time;
			this.author = author;
			this.message = message;
			this.changedFiles = changedFiles;
		}
		public override void CopyConfigurationFrom (Repository other)
		{
			base.CopyConfigurationFrom (other);
			
			UrlBasedRepository ot = (UrlBasedRepository) other;
			url = ot.url;
			CreateUri ();
		}
		public PublishWorker (Repository vc, string moduleName, FilePath localPath, FilePath[] files, string message) 
		{
			this.vc = vc;
			this.path = localPath;
			this.moduleName = moduleName;
			this.files = files;
			this.message = message;
			OperationType = VersionControlOperationType.Push;
		}
		public virtual void TearDown ()
		{
			if (Repo != null) {
				Repo.Dispose ();
				Repo = null;
			}
			DeleteDirectory (RemotePath);
			DeleteDirectory (LocalPath);
			AddedItems.Clear ();
			CommitNumber = 0;
		}
Esempio n. 14
0
		internal protected ChangeSet (Repository repo, FilePath basePath)
		{
			this.repo = repo;
			
			//make sure the base path has a trailign slash, or ChangeLogWriter's
			//GetDirectoryName call on it will take us up a directory
			string bp = basePath.ToString ();
			if (bp[bp.Length -1] != System.IO.Path.DirectorySeparatorChar)
				basePath = bp + System.IO.Path.DirectorySeparatorChar;
			
			this.basePath = basePath;
		}
Esempio n. 15
0
		internal protected ChangeSet (Repository repo, FilePath basePath)
		{
			this.repo = repo;

			// Make sure the path has a trailing slash or the ChangeLogWriter's
			// call to GetDirectoryName will take us one extra directory up.
			string bp = basePath.ToString ();
			if (bp [bp.Length - 1] != System.IO.Path.DirectorySeparatorChar)
				basePath = bp + System.IO.Path.DirectorySeparatorChar;

			this.basePath = basePath;
		}
		public override void CopyConfigurationFrom (Repository other)
		{
			base.CopyConfigurationFrom (other);
			
			UrlBasedRepository ot = (UrlBasedRepository) other;
			dir = ot.dir;
			user = ot.user;
			pass = ot.pass;
			port = ot.port;
			server = ot.server;
			method = ot.method;
		}
		void AddFolderOverlay (Repository rep, string folder, ref Gdk.Pixbuf icon, ref Gdk.Pixbuf closedIcon)
		{
			Gdk.Pixbuf overlay = null;
			VersionInfo vinfo = rep.GetVersionInfo (folder, false);
			if (vinfo == null || !vinfo.IsVersioned) {
				overlay = VersionControlService.LoadOverlayIconForStatus (VersionStatus.Unversioned);
			} else if (vinfo.IsVersioned && !vinfo.HasLocalChanges) {
				overlay = VersionControlService.overlay_controled;
			} else {
				overlay = VersionControlService.LoadOverlayIconForStatus (vinfo.Status);
			}
			if (overlay != null) {
				AddOverlay (ref icon, overlay);
				if (closedIcon != null)
					AddOverlay (ref closedIcon, overlay);
			}
		}
		public VersionControlItem (Repository repository, WorkspaceObject workspaceObject, FilePath path, bool isDirectory, VersionInfo versionInfo)
		{
			Path = path;
			Repository = repository;
			WorkspaceObject = workspaceObject;
			IsDirectory = isDirectory;
			this.versionInfo = versionInfo;

			var obj = workspaceObject;
			while (obj != null) {
				var p = obj as Project;
				if (p != null)
					ContainerProject = p;

				obj = obj.ParentObject;
			}
		}
Esempio n. 19
0
		public static bool Commit (Repository vc, ChangeSet changeSet, bool test)
		{
			try {
				if (changeSet.IsEmpty) {
					if (!test)
						MessageService.ShowMessage (GettextCatalog.GetString ("There are no changes to be committed."));
					return false;
				}
				
				if (vc.GetVersionInfo (changeSet.BaseLocalPath).CanCommit) {
					if (test)
						return true;

					if (!VersionControlService.NotifyPrepareCommit (vc, changeSet))
						return false;
					CommitDialog dlg = new CommitDialog (changeSet);
					try {
						if (MessageService.RunCustomDialog (dlg) == (int) Gtk.ResponseType.Ok) {
							if (VersionControlService.NotifyBeforeCommit (vc, changeSet)) {
								new CommitWorker (vc, changeSet, dlg).Start();
								return true;
							}
						}
						dlg.EndCommit (false);
					} finally {
						dlg.Destroy ();
					}
					VersionControlService.NotifyAfterCommit (vc, changeSet, false);
				}
				return false;
			}
			catch (Exception ex) {
				if (test)
					LoggingService.LogError (ex.ToString ());
				else
					MessageService.ShowException (ex, GettextCatalog.GetString ("Version control command failed."));
				return false;
			}
		}
		public static void Commit (Repository vc, ChangeSet changeSet)
		{
			try {
				VersionControlService.NotifyPrepareCommit (vc, changeSet);

				CommitDialog dlg = new CommitDialog (changeSet);
				try {
					if (MessageService.RunCustomDialog (dlg) == (int) Gtk.ResponseType.Ok) {
						VersionControlService.NotifyBeforeCommit (vc, changeSet);
							new CommitWorker (vc, changeSet, dlg).Start();
							return;
						}
					dlg.EndCommit (false);
				} finally {
					dlg.Destroy ();
					dlg.Dispose ();
				}
				VersionControlService.NotifyAfterCommit (vc, changeSet, false);
			}
			catch (Exception ex) {
				MessageService.ShowError (GettextCatalog.GetString ("Version control command failed."), ex);
			}
		}
		public virtual void UpdateIsDone ()
		{
			string added = rootCheckout + "testfile";
			File.Create (added).Close ();
			repo.Add (added, false, new NullProgressMonitor ());
			ChangeSet changes = repo.CreateChangeSet (repo.RootPath);
			changes.AddFile (repo.GetVersionInfo (added, VersionInfoQueryFlags.IgnoreCache));
			changes.GlobalComment = "test";
			repo.Commit (changes, new NullProgressMonitor ());

			PostCommit (repo);

			// Checkout a second repository.
			FilePath second = new FilePath (FileService.CreateTempDirectory () + Path.DirectorySeparatorChar);
			Checkout (second, repoLocation);
			repo2 = GetRepo (second, repoLocation);
			added = second + "testfile2";
			File.Create (added).Close ();
			repo2.Add (added, false, new NullProgressMonitor ());
			changes = repo.CreateChangeSet (repo.RootPath);
			changes.AddFile (repo.GetVersionInfo (added, VersionInfoQueryFlags.IgnoreCache));
			changes.GlobalComment = "test2";
			repo2.Commit (changes, new NullProgressMonitor ());

			PostCommit (repo2);

			repo.Update (repo.RootPath, true, new NullProgressMonitor ());
			Assert.True (File.Exists (rootCheckout + "testfile2"));

			DeleteDirectory (second);
		}
		protected virtual void PostCommit (Repository repo)
		{
		}
		public virtual void Checkout (string path, string url)
		{
			Repository _repo = GetRepo (path, url);
			_repo.Checkout (path, true, new NullProgressMonitor ());
			if (repo == null)
				repo = _repo;
			else
				repo2 = _repo;
		}
 protected virtual void ModifyPath(Repository repo, ref FilePath old)
 {
 }
 protected void Checkout(string path, string url)
 {
     Repository _repo = GetRepo (path, url);
     _repo.Checkout (path, true, new NullProgressMonitor ());
     if (Repo == null)
         Repo = _repo;
     else
         Repo2 = _repo;
 }
        public virtual void UpdateIsDone()
        {
            AddFile ("testfile", null, true, true);
            PostCommit (Repo);

            // Checkout a second repository.
            FilePath second = new FilePath (FileService.CreateTempDirectory () + Path.DirectorySeparatorChar);
            Checkout (second, RemoteUrl);
            Repo2 = GetRepo (second, RemoteUrl);
            ModifyPath (Repo2, ref second);
            string added = second + "testfile2";
            File.Create (added).Close ();
            Repo2.Add (added, false, new NullProgressMonitor ());
            ChangeSet changes = Repo2.CreateChangeSet (Repo2.RootPath);
            changes.AddFile (Repo2.GetVersionInfo (added, VersionInfoQueryFlags.IgnoreCache));
            changes.GlobalComment = "test2";
            Repo2.Commit (changes, new NullProgressMonitor ());

            PostCommit (Repo2);

            Repo.Update (Repo.RootPath, true, new NullProgressMonitor ());
            Assert.True (File.Exists (LocalPath + "testfile2"));

            Repo2.Dispose ();
            DeleteDirectory (second);
        }
		protected void Checkout (string path, string url)
		{
			var mockRepo = (UrlBasedRepository)GetRepo ();
			mockRepo.Url = url;
			mockRepo.Checkout (path, true, new ProgressMonitor ());

			var _repo = GetRepo (path, url);
			if (Repo == null)
				Repo = _repo;
			else
				Repo2 = _repo;
		}
		protected abstract void CheckLog (Repository repo);
Esempio n. 29
0
		protected override void PostCommit (Repository repo)
		{
			GitRepository repo2 = (GitRepository)repo;
			repo2.Push (new MonoDevelop.Core.ProgressMonitoring.NullProgressMonitor (), repo2.GetCurrentRemote (), repo2.GetCurrentBranch ());
		}
 public CheckoutWorker(Repository vc, string path)
 {
     this.vc       = vc;
     this.path     = path;
     OperationType = VersionControlOperationType.Pull;
 }
Esempio n. 31
0
		protected Revision (Repository repo)
		{
			this.repo = repo;
		}
Esempio n. 32
0
 public VersionInfoCache(Repository repo)
 {
     this.repo = repo;
 }
Esempio n. 33
0
 public static Task <bool> RevertToRevisionAsync(Repository vc, string path, Revision revision, bool test, CancellationToken cancellationToken = default)
 {
     return(RevertRevisionsAsync(vc, path, revision, test, true, cancellationToken));
 }