コード例 #1
0
		void SolutionCreated(object sender, SolutionEventArgs e)
		{
			if (!AddInOptions.AutomaticallyAddFiles) return;
			string solutionFileName = e.Solution.FileName;
			string solutionDirectory = e.Solution.Directory;
			
			if (!CanBeVersionControlledFile(solutionDirectory)) return;
			
			try {
				using (SvnClientWrapper client = new SvnClientWrapper()) {
					SvnMessageView.HandleNotifications(client);
					
					Status status = client.SingleStatus(solutionDirectory);
					if (status.TextStatus == StatusKind.Unversioned) {
						client.Add(solutionDirectory, Recurse.None);
					}
					status = client.SingleStatus(solutionFileName);
					if (status.TextStatus == StatusKind.Unversioned) {
						client.Add(solutionFileName, Recurse.None);
						client.AddToIgnoreList(solutionDirectory, Path.GetFileName(solutionFileName) + ".cache");
					}
				}
				foreach (IProject p in e.Solution.Projects) {
					ProjectCreated(null, new ProjectEventArgs(p));
				}
			} catch (SvnClientException ex) {
				MessageService.ShowError(ex.Message);
			} catch (Exception ex) {
				MessageService.ShowError(ex, "Solution add exception");
			}
		}
コード例 #2
0
        void ProjectCreated(object sender, ProjectEventArgs e)
        {
            if (!AddInOptions.AutomaticallyAddFiles)
            {
                return;
            }
            if (!CanBeVersionControlledFile(e.Project.Directory))
            {
                return;
            }

            string projectDir = Path.GetFullPath(e.Project.Directory);

            try {
                using (SvnClientWrapper client = new SvnClientWrapper()) {
                    SvnMessageView.HandleNotifications(client);

                    Status status = client.SingleStatus(projectDir);
                    if (status.TextStatus != StatusKind.Unversioned)
                    {
                        return;
                    }
                    client.Add(projectDir, Recurse.None);
                    if (FileUtility.IsBaseDirectory(Path.Combine(projectDir, "bin"), e.Project.OutputAssemblyFullPath))
                    {
                        client.AddToIgnoreList(projectDir, "bin");
                    }
                    CompilableProject compilableProject = e.Project as CompilableProject;
                    if (compilableProject != null)
                    {
                        if (FileUtility.IsBaseDirectory(Path.Combine(projectDir, "obj"), compilableProject.IntermediateOutputFullPath))
                        {
                            client.AddToIgnoreList(projectDir, "obj");
                        }
                    }
                    foreach (ProjectItem item in e.Project.Items)
                    {
                        FileProjectItem fileItem = item as FileProjectItem;
                        if (fileItem != null)
                        {
                            if (FileUtility.IsBaseDirectory(projectDir, fileItem.FileName))
                            {
                                AddFileWithParentDirectoriesToSvn(client, fileItem.FileName);
                            }
                        }
                    }
                    AddFileWithParentDirectoriesToSvn(client, e.Project.FileName);
                }
            } catch (SvnClientException ex) {
                MessageService.ShowError(ex.Message);
            } catch (Exception ex) {
                MessageService.ShowException(ex, "Project add exception");
            }
        }
コード例 #3
0
 private static void AddFileWithParentDirectoriesToSvn(SvnClientWrapper client, string fileName)
 {
     if (!LocalHelper.CanBeVersionControlledFile(fileName))
     {
         AddFileWithParentDirectoriesToSvn(client, FileUtility.GetAbsolutePath(fileName, ".."));
     }
     var status = client.SingleStatus(fileName);
     if (status.TextStatus != StatusKind.Unversioned)
         return;
     client.Add(fileName, Recurse.None);
 }
コード例 #4
0
        void SolutionCreated(object sender, SolutionEventArgs e)
        {
            if (!AddInOptions.AutomaticallyAddFiles)
            {
                return;
            }
            string solutionFileName  = e.Solution.FileName;
            string solutionDirectory = e.Solution.Directory;

            if (!CanBeVersionControlledFile(solutionDirectory))
            {
                return;
            }

            try {
                using (SvnClientWrapper client = new SvnClientWrapper()) {
                    SvnMessageView.HandleNotifications(client);

                    Status status = client.SingleStatus(solutionDirectory);
                    if (status.TextStatus == StatusKind.Unversioned)
                    {
                        client.Add(solutionDirectory, Recurse.None);
                    }
                    status = client.SingleStatus(solutionFileName);
                    if (status.TextStatus == StatusKind.Unversioned)
                    {
                        client.Add(solutionFileName, Recurse.None);
                        client.AddToIgnoreList(solutionDirectory, Path.GetFileName(solutionFileName) + ".cache");
                    }
                }
                foreach (IProject p in e.Solution.Projects)
                {
                    ProjectCreated(null, new ProjectEventArgs(p));
                }
            } catch (SvnClientException ex) {
                MessageService.ShowError(ex.Message);
            } catch (Exception ex) {
                MessageService.ShowException(ex, "Solution add exception");
            }
        }
コード例 #5
0
        void AddFileWithParentDirectoriesToSvn(SvnClientWrapper client, string fileName)
        {
            if (!CanBeVersionControlledFile(fileName))
            {
                AddFileWithParentDirectoriesToSvn(client, FileUtility.GetAbsolutePath(fileName, ".."));
            }
            Status status = client.SingleStatus(fileName);

            if (status.TextStatus != StatusKind.Unversioned)
            {
                return;
            }
            client.Add(fileName, Recurse.None);
        }
コード例 #6
0
        /// <summary>
        /// Adds the newly created file to the repository.
        /// </summary>
        /// <param name="sender">Not used.</param>
        /// <param name="e">The name of the file and whether it is a directory or not.</param>
        void FileCreated(object sender, FileEventArgs e)
        {
            if (!AddInOptions.AutomaticallyAddFiles)
            {
                return;
            }
            if (!Path.IsPathRooted(e.FileName))
            {
                return;
            }

            string fullName = Path.GetFullPath(e.FileName);

            if (!CanBeVersionControlledFile(fullName))
            {
                return;
            }
            try {
                using (SvnClientWrapper client = new SvnClientWrapper()) {
                    SvnMessageView.HandleNotifications(client);

                    Status status = client.SingleStatus(fullName);
                    switch (status.TextStatus)
                    {
                    case StatusKind.Unversioned:
                    case StatusKind.Deleted:
                        using (SharpDevelop.Gui.AsynchronousWaitDialog.ShowWaitDialog("svn add")) {
                            client.Add(fullName, Recurse.None);
                        }
                        break;
                    }
                }
            } catch (SvnClientException ex) {
                MessageService.ShowError(ex.Message);
            }
        }
コード例 #7
0
		void ProjectCreated(object sender, ProjectEventArgs e)
		{
			if (!AddInOptions.AutomaticallyAddFiles) return;
			if (!CanBeVersionControlledFile(e.Project.Directory)) return;
			
			string projectDir = Path.GetFullPath(e.Project.Directory);
			try {
				using (SvnClientWrapper client = new SvnClientWrapper()) {
					SvnMessageView.HandleNotifications(client);
					
					Status status = client.SingleStatus(projectDir);
					if (status.TextStatus != StatusKind.Unversioned)
						return;
					client.Add(projectDir, Recurse.None);
					if (FileUtility.IsBaseDirectory(Path.Combine(projectDir, "bin"), e.Project.OutputAssemblyFullPath)) {
						client.AddToIgnoreList(projectDir, "bin");
					}
					CompilableProject compilableProject = e.Project as CompilableProject;
					if (compilableProject != null) {
						if (FileUtility.IsBaseDirectory(Path.Combine(projectDir, "obj"), compilableProject.IntermediateOutputFullPath)) {
							client.AddToIgnoreList(projectDir, "obj");
						}
					}
					foreach (ProjectItem item in e.Project.Items) {
						FileProjectItem fileItem = item as FileProjectItem;
						if (fileItem != null) {
							if (FileUtility.IsBaseDirectory(projectDir, fileItem.FileName)) {
								AddFileWithParentDirectoriesToSvn(client, fileItem.FileName);
							}
						}
					}
					AddFileWithParentDirectoriesToSvn(client, e.Project.FileName);
				}
			} catch (SvnClientException ex) {
				MessageService.ShowError(ex.Message);
			} catch (Exception ex) {
				MessageService.ShowError(ex, "Project add exception");
			}
		}
コード例 #8
0
		/// <summary>
		/// Adds the newly created file to the repository.
		/// </summary>
		/// <param name="sender">Not used.</param>
		/// <param name="e">The name of the file and whether it is a directory or not.</param>
		void FileCreated(object sender, FileEventArgs e)
		{
			if (!AddInOptions.AutomaticallyAddFiles) return;
			if (!Path.IsPathRooted(e.FileName)) return;
			
			string fullName = Path.GetFullPath(e.FileName);
			if (!CanBeVersionControlledFile(fullName)) return;
			try {
				using (SvnClientWrapper client = new SvnClientWrapper()) {
					SvnMessageView.HandleNotifications(client);
					
					Status status = client.SingleStatus(fullName);
					switch (status.TextStatus) {
						case StatusKind.Unversioned:
						case StatusKind.Deleted:
							using (SharpDevelop.Gui.AsynchronousWaitDialog.ShowWaitDialog("svn add")) {
								client.Add(fullName, Recurse.None);
							}
							break;
					}
				}
			} catch (Exception ex) {
				MessageService.ShowError("File add exception: " + ex);
			}
		}