Exemple #1
0
		public static bool Show (VersionControlItemList items, bool test)
		{
			if (!test) {
				Show (items);
				return true;
			}
			else
				return items.All (i => i.VersionInfo.CanAnnotate);
		}
		public static bool Add (VersionControlItemList items, bool test)
		{
			if (!items.All (i => i.VersionInfo.CanAdd))
				return false;
			if (test)
				return true;
			
			new AddWorker (items).Start();
			return true;
		}
Exemple #3
0
 public static bool Show(VersionControlItemList items, bool test)
 {
     if (!test)
     {
         Show(items);
         return(true);
     }
     else
     {
         return(items.All(i => i.VersionInfo.CanAnnotate));
     }
 }
		public static bool Show (VersionControlItemList items, bool test)
		{
			if (test)
				return items.All (CanShow);
			
			foreach (var item in items) {
				var document = IdeApp.Workbench.OpenDocument (item.Path, item.ContainerProject, OpenDocumentOptions.Default | OpenDocumentOptions.OnlyInternalViewer);
				if (document != null)
					document.Window.SwitchView (document.Window.FindView<IMergeView> ());
			}
			
			return true;
		}
		public static async Task<bool> ResolveConflicts (VersionControlItemList list, bool test)
		{
			if (test)
				return list.All (s => (s.VersionInfo.Status & VersionStatus.Conflicted) == VersionStatus.Conflicted);

			foreach (var item in list.Where (s => (s.VersionInfo.Status & VersionStatus.Conflicted) == VersionStatus.Conflicted)) {
				Document doc = await IdeApp.Workbench.OpenDocument (item.Path, item.ContainerProject, true);
				foreach (var view in doc.Views) {
					if (view.GetContent <MergeView> () != null)
						view.Select ();
				}
			}
			return true;
		}
		public static bool Show (VersionControlItemList items, bool test)
		{
			if (test)
				return items.All (CanShow);
			
			foreach (var item in items) {
				var document = IdeApp.Workbench.OpenDocument (item.Path, OpenDocumentOptions.Default | OpenDocumentOptions.OnlyInternalViewer);
				if (document != null) {
					document.Window.SwitchView (document.Window.FindView<ILogView> ());
				} else {
					VersionControlDocumentInfo info = new VersionControlDocumentInfo (null, item, item.Repository);
					LogView logView = new LogView (info);
					info.Document = IdeApp.Workbench.OpenDocument (logView, true).PrimaryView;
					logView.Selected ();	
				}
			}
			
			return true;
		}
		static bool IgnoreInternal (VersionControlItemList items, bool test)
		{
			try {
				if (test)
					return items.All (x => x.VersionInfo.Status == VersionStatus.Unversioned);

				if (MessageService.AskQuestion (GettextCatalog.GetString ("Are you sure you want to ignore the selected files?"),
				                                AlertButton.No, AlertButton.Yes) != AlertButton.Yes)
					return false;

				new IgnoreWorker (items).Start();
				return true;
			}
			catch (Exception ex) {
				if (test)
					LoggingService.LogError (ex.ToString ());
				else
					MessageService.ShowError (GettextCatalog.GetString ("Version control command failed."), ex);
				return false;
			}
		}
		private static bool RevertInternal (VersionControlItemList items, bool test)
		{
			try {
				if (test)
					return items.All (i => i.VersionInfo.CanRevert);

				if (MessageService.AskQuestion (GettextCatalog.GetString ("Are you sure you want to revert the changes done in the selected files?"), 
				                                GettextCatalog.GetString ("All changes made to the selected files will be permanently lost."),
				                                AlertButton.Cancel, AlertButton.Revert) != AlertButton.Revert)
					return false;

				new RevertWorker (items).Start();
				return true;
			}
			catch (Exception ex) {
				if (test)
					LoggingService.LogError (ex.ToString ());
				else
					MessageService.ShowError (GettextCatalog.GetString ("Version control command failed."), ex);
				return false;
			}
		}
Exemple #9
0
		public static async Task<bool> Show (VersionControlItemList items, bool test)
		{
			if (test)
				return items.All (CanShow);
			
			foreach (var item in items) {
				Document document = null;
				if (!item.IsDirectory)
					document = await IdeApp.Workbench.OpenDocument (item.Path, item.ContainerProject, OpenDocumentOptions.Default | OpenDocumentOptions.OnlyInternalViewer);

				if (document != null) {
					document.Window.SwitchView (document.Window.FindView<ILogView> ());
				} else {
					VersionControlDocumentInfo info = new VersionControlDocumentInfo (null, item, item.Repository);
					LogView logView = new LogView (info);
					info.Document = IdeApp.Workbench.OpenDocument (logView, true).PrimaryView;
					logView.Init ();
				}
			}
			
			return true;
		}
		public static bool Remove (VersionControlItemList items, bool test)
		{
			if (!items.All (i => i.VersionInfo.CanRemove))
				return false;
			if (test)
				return true;
			
			string msg = GettextCatalog.GetString ("Are you sure you want to remove the selected items from the version control system?");
			string msg2 = GettextCatalog.GetString ("The files will be kept on disk.");
			if (MessageService.Confirm (msg, msg2, AlertButton.Delete))
				new RemoveWorker (items).Start();
			return true;
		}
		public static bool CanShow (VersionControlItemList items, Revision since)
		{
			return items.All (i => i.VersionInfo.CanLog);
		}
Exemple #12
0
 public static bool CanShow(VersionControlItemList items, Revision since)
 {
     return(items.All(i => i.VersionInfo.CanLog));
 }
		/// <summary>
		/// Determines whether a patch can be created 
		/// from a VersionControlItemList.
		/// </summary>
		public static bool CanCreatePatch (VersionControlItemList items) 
		{
			if (null == items || 0 == items.Count){ return false; }
			return items.All (i => i.VersionInfo.CanRevert);
		}
Exemple #14
0
		static bool UnignoreInternal (VersionControlItemList items, bool test)
		{
			try {
				// NGit doesn't return a version info for ignored files.
				if (test)
					return items.All (x => (x.VersionInfo.Status & (VersionStatus.ScheduledIgnore | VersionStatus.Ignored)) != VersionStatus.Unversioned);

				if (MessageService.AskQuestion (GettextCatalog.GetString ("Are you sure you want to unignore the selected files?"),
				                                AlertButton.No, AlertButton.Yes) != AlertButton.Yes)
					return false;

				new UnignoreWorker (items).Start();
				return true;
			}
			catch (Exception ex) {
				if (test)
					LoggingService.LogError (ex.ToString ());
				else
					MessageService.ShowException (ex, GettextCatalog.GetString ("Version control command failed."));
				return false;
			}
		}