public static StatusKind GetStatus(string fileName)
        {
            lock (clientLock) {
                if (subversionDisabled)
                {
                    return(StatusKind.None);
                }

                //Console.WriteLine(fileName);

                if (client == null)
                {
                    try {
                        client = new SvnClientWrapper();
                    } catch (Exception ex) {
                        subversionDisabled = true;
                        SharpDevelop.Gui.WorkbenchSingleton.SafeThreadAsyncCall(
                            MessageService.ShowWarning,
                            "Error initializing Subversion library:\n" + ex.ToString()
                            );
                        return(StatusKind.None);
                    }
                }

                try {
                    return(client.SingleStatus(fileName).TextStatus);
                } catch (SvnClientException ex) {
                    LoggingService.Warn(ex);
                    return(StatusKind.None);
                }
            }
        }
Ejemplo n.º 2
0
 void GetLogMessages()
 {
     try {
         LoggingService.Info("SVN: Get log of " + fileName);
         if (File.Exists(fileName))
         {
             using (SvnClientWrapper client = new SvnClientWrapper()) {
                 client.AllowInteractiveAuthorization();
                 client.Log(new string[] { fileName },
                            Revision.Head,                                  // Revision start
                            Revision.FromNumber(1),                         // Revision end
                            int.MaxValue,                                   // Limit
                            false,                                          // bool discoverChangePath
                            false,                                          // bool strictNodeHistory
                            ReceiveLogMessage);
             }
         }
     } catch (Exception ex) {
         // if exceptions aren't caught here, they force SD to exit
         if (ex is SvnClientException || ex is System.Runtime.InteropServices.SEHException)
         {
             LoggingService.Warn(ex);
             SD.MainThread.InvokeAsyncAndForget(() => infoPanel.ShowError(ex));
         }
         else
         {
             MessageService.ShowException(ex);
         }
     }
 }
Ejemplo n.º 3
0
 void GetLogMessages()
 {
     try {
         LoggingService.Info("SVN: Get log of " + fileName);
         if (File.Exists(fileName)) {
             using (SvnClientWrapper client = new SvnClientWrapper()) {
                 client.AllowInteractiveAuthorization();
                 client.Log(new string[] { fileName },
                            Revision.Head,          // Revision start
                            Revision.FromNumber(1), // Revision end
                            int.MaxValue,           // Limit
                            false,                  // bool discoverChangePath
                            false,                  // bool strictNodeHistory
                            ReceiveLogMessage);
             }
         }
     } catch (Exception ex) {
         // if exceptions aren't caught here, they force SD to exit
         if (ex is SvnClientException || ex is System.Runtime.InteropServices.SEHException) {
             LoggingService.Warn(ex);
             SD.MainThread.InvokeAsyncAndForget(() => infoPanel.ShowError(ex));
         } else {
             MessageService.ShowException(ex);
         }
     }
 }
Ejemplo n.º 4
0
        public static StatusKind GetStatus(string fileName)
        {
            lock (clientLock) {
                if (subversionDisabled)
                {
                    return(StatusKind.None);
                }

                //Console.WriteLine(fileName);

                if (client == null)
                {
                    try {
                        client = new SvnClientWrapper();
                    } catch (Exception ex) {
                        subversionDisabled = true;
                        SD.MainThread.InvokeAsyncAndForget(() => MessageService.ShowWarning("Error initializing Subversion library:\n" + ex.ToString()));
                        return(StatusKind.None);
                    }
                }

                try {
                    return(client.SingleStatus(fileName).TextStatus);
                } catch (SvnClientException ex) {
                    LoggingService.Warn(ex);
                    return(StatusKind.None);
                }
            }
        }
Ejemplo n.º 5
0
		public Stream OpenBaseVersion(string fileName)
		{
			if (!SvnClientWrapper.IsInSourceControl(fileName))
				return null;
			
			using (SvnClientWrapper client = new SvnClientWrapper())
				return client.OpenBaseVersion(fileName);
		}
Ejemplo n.º 6
0
        public Stream OpenBaseVersion(string fileName)
        {
            if (!SvnClientWrapper.IsInSourceControl(fileName))
            {
                return(null);
            }

            using (SvnClientWrapper client = new SvnClientWrapper())
                return(client.OpenBaseVersion(fileName));
        }
Ejemplo n.º 7
0
		public Task<Stream> OpenBaseVersionAsync(FileName fileName)
		{
			return Task.Run(() => {
				if (!SvnClientWrapper.IsInSourceControl(fileName))
					return null;
				
				using (SvnClientWrapper client = new SvnClientWrapper())
					return client.OpenBaseVersion(fileName);
			});
		}
Ejemplo n.º 8
0
        public Task <Stream> OpenBaseVersionAsync(FileName fileName)
        {
            return(Task.Run(() => {
                if (!SvnClientWrapper.IsInSourceControl(fileName))
                {
                    return null;
                }

                using (SvnClientWrapper client = new SvnClientWrapper())
                    return client.OpenBaseVersion(fileName);
            }));
        }
Ejemplo n.º 9
0
        public bool CanAttachTo(ICSharpCode.SharpDevelop.Gui.IViewContent content)
        {
            if (!AddInOptions.UseHistoryDisplayBinding)
            {
                return(false);
            }
            OpenedFile file = content.PrimaryFile;

            if (file == null || file.IsUntitled || !File.Exists(file.FileName))
            {
                return(false);
            }

            return(SvnClientWrapper.IsInSourceControl(file.FileName));
        }
Ejemplo n.º 10
0
 void LoadChangedPaths(object state)
 {
     try {
         LogMessage logMessage = (LogMessage)loadChangedPathsItem.Tag;
         using (SvnClientWrapper client = new SvnClientWrapper()) {
             client.AllowInteractiveAuthorization();
             try {
                 client.Log(new string[] { fileName },
                            Revision.FromNumber(logMessage.Revision),       // Revision start
                            Revision.FromNumber(logMessage.Revision),       // Revision end
                            int.MaxValue,                                   // limit
                            true,                                           // bool discoverChangePath
                            false,                                          // bool strictNodeHistory
                            ReceiveChangedPaths);
             } catch (SvnClientException ex) {
                 if (ex.IsKnownError(KnownError.FileNotFound))
                 {
                     // This can happen when the file was renamed/moved so it cannot be found
                     // directly in the old revision. In that case, we do a full download of
                     // all revisions (so the file can be found in the new revision and svn can
                     // follow back its history).
                     client.Log(new string[] { fileName },
                                Revision.FromNumber(1),                             // Revision start
                                Revision.FromNumber(lastRevision),                  // Revision end
                                int.MaxValue,                                       // limit
                                true,                                               // bool discoverChangePath
                                false,                                              // bool strictNodeHistory
                                ReceiveAllChangedPaths);
                 }
                 else
                 {
                     throw;
                 }
             }
         }
         loadChangedPathsItem  = null;
         isLoadingChangedPaths = false;
         WorkbenchSingleton.SafeThreadAsyncCall <object, EventArgs>(this.RevisionListViewSelectionChanged, null, EventArgs.Empty);
     } catch (Exception ex) {
         MessageService.ShowError(ex);
     }
 }
Ejemplo n.º 11
0
 public static void HandleNotifications(SvnClientWrapper client)
 {
     client.Notify += delegate(object sender, NotificationEventArgs e) {
         AppendLine(e.Kind + e.Action + " " + e.Path);
     };
     AsynchronousWaitDialog waitDialog = null;
     client.OperationStarted += delegate(object sender, SubversionOperationEventArgs e) {
         if (waitDialog == null) {
             waitDialog = AsynchronousWaitDialog.ShowWaitDialog("svn " + e.Operation);
     //					waitDialog.Cancelled += delegate {
     //						client.Cancel();
     //					};
         }
     };
     client.OperationFinished += delegate {
         if (waitDialog != null) {
             waitDialog.Dispose();
             waitDialog = null;
         }
     };
 }
Ejemplo n.º 12
0
        public static void HandleNotifications(SvnClientWrapper client)
        {
            client.Notify += delegate(object sender, NotificationEventArgs e) {
                AppendLine(e.Kind + e.Action + " " + e.Path);
            };
            AsynchronousWaitDialog waitDialog = null;

            client.OperationStarted += delegate(object sender, SubversionOperationEventArgs e) {
                if (waitDialog == null)
                {
                    waitDialog = AsynchronousWaitDialog.ShowWaitDialog("svn " + e.Operation);
//					waitDialog.Cancelled += delegate {
//						client.Cancel();
//					};
                }
            };
            client.OperationFinished += delegate {
                if (waitDialog != null)
                {
                    waitDialog.Dispose();
                    waitDialog = null;
                }
            };
        }
Ejemplo n.º 13
0
		void LoadChangedPaths(object state)
		{
			try {
				LogMessage logMessage = (LogMessage)loadChangedPathsItem.Tag;
				using (SvnClientWrapper client = new SvnClientWrapper()) {
					client.AllowInteractiveAuthorization();
					try {
						client.Log(new string[] { fileName },
						           Revision.FromNumber(logMessage.Revision), // Revision start
						           Revision.FromNumber(logMessage.Revision), // Revision end
						           int.MaxValue,           // limit
						           true,                   // bool discoverChangePath
						           false,                  // bool strictNodeHistory
						           ReceiveChangedPaths);
					} catch (SvnClientException ex) {
						if (ex.IsKnownError(KnownError.FileNotFound)) {
							// This can happen when the file was renamed/moved so it cannot be found
							// directly in the old revision. In that case, we do a full download of
							// all revisions (so the file can be found in the new revision and svn can
							// follow back its history).
							client.Log(new string[] { fileName },
							           Revision.FromNumber(1),            // Revision start
							           Revision.FromNumber(lastRevision), // Revision end
							           int.MaxValue,           // limit
							           true,                   // bool discoverChangePath
							           false,                  // bool strictNodeHistory
							           ReceiveAllChangedPaths);
						} else {
							throw;
						}
					}
				}
				loadChangedPathsItem = null;
				isLoadingChangedPaths = false;
				SD.MainThread.InvokeAsyncAndForget(() => this.RevisionListViewSelectionChanged(null, EventArgs.Empty));
			} catch (Exception ex) {
				MessageService.ShowException(ex);
			}
		}
Ejemplo n.º 14
0
		public static StatusKind GetStatus(string fileName)
		{
			lock (clientLock) {
				if (subversionDisabled)
					return StatusKind.None;
				
				//Console.WriteLine(fileName);
				
				if (client == null) {
					try {
						client = new SvnClientWrapper();
					} catch (Exception ex) {
						subversionDisabled = true;
						SD.MainThread.InvokeAsyncAndForget(() => MessageService.ShowWarning("Error initializing Subversion library:\n" + ex.ToString()));
						return StatusKind.None;
					}
				}
				
				try {
					return client.SingleStatus(fileName).TextStatus;
				} catch (SvnClientException ex) {
					LoggingService.Warn(ex);
					return StatusKind.None;
				}
			}
		}
		public static StatusKind GetStatus(string fileName)
		{
			lock (clientLock) {
				if (subversionDisabled)
					return StatusKind.None;
				
				//Console.WriteLine(fileName);
				
				if (client == null) {
					try {
						client = new SvnClientWrapper();
					} catch (Exception ex) {
						subversionDisabled = true;
						SharpDevelop.Gui.WorkbenchSingleton.SafeThreadAsyncCall(
							MessageService.ShowWarning,
							"Error initializing Subversion library:\n" + ex.ToString()
						);
						return StatusKind.None;
					}
				}
				
				try {
					return client.SingleStatus(fileName).TextStatus;
				} catch (SvnClientException ex) {
					LoggingService.Warn("Error getting status of " + fileName, ex);
					return StatusKind.None;
				}
			}
		}
Ejemplo n.º 16
0
        void RevisionListViewSelectionChanged(object sender, EventArgs e)
        {
            changesListView.Items.Clear();
            if (revisionListView.SelectedItems.Count == 0)
            {
                commentRichTextBox.Text    = "";
                commentRichTextBox.Enabled = false;
                return;
            }
            commentRichTextBox.Enabled = true;
            ListViewItem item       = revisionListView.SelectedItems[0];
            LogMessage   logMessage = item.Tag as LogMessage;

            commentRichTextBox.Text = logMessage.Message;
            List <ChangedPath> changes = logMessage.ChangedPaths;

            if (changes == null)
            {
                changesListView.Items.Add("Loading...");
                if (!isLoadingChangedPaths)
                {
                    isLoadingChangedPaths = true;
                    loadChangedPathsItem  = item;
                    ThreadPool.QueueUserWorkItem(LoadChangedPaths);
                }
            }
            else
            {
                int pathWidth     = 70;
                int copyFromWidth = 70;
                using (Graphics g = CreateGraphics()) {
                    foreach (ChangedPath change in changes)
                    {
                        string path = change.Path;
                        path = path.Replace('\\', '/');
                        SizeF size = g.MeasureString(path, changesListView.Font);
                        if (size.Width + 4 > pathWidth)
                        {
                            pathWidth = (int)size.Width + 4;
                        }
                        string copyFrom = change.CopyFromPath;
                        if (copyFrom == null)
                        {
                            copyFrom = string.Empty;
                        }
                        else
                        {
                            copyFrom = copyFrom + " : r" + change.CopyFromRevision;
                            size     = g.MeasureString(copyFrom, changesListView.Font);
                            if (size.Width + 4 > copyFromWidth)
                            {
                                copyFromWidth = (int)size.Width + 4;
                            }
                        }
                        ListViewItem newItem = new ListViewItem(new string[] {
                            SvnClientWrapper.GetActionString(change.Action),
                            path,
                            copyFrom
                        });
                        changesListView.Items.Add(newItem);
                    }
                }
                changesListView.Columns[1].Width = pathWidth;
                changesListView.Columns[2].Width = copyFromWidth;
            }
        }