Add() 공개 메소드

public Add ( FilePath localPath, bool recurse, MonoDevelop.Core.ProgressMonitor monitor ) : void
localPath FilePath
recurse bool
monitor MonoDevelop.Core.ProgressMonitor
리턴 void
        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);
        }
		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);
		}
예제 #3
0
        static void OnEntryAdded(object o, SolutionItemEventArgs args)
        {
            if (args is SolutionItemChangeEventArgs && ((SolutionItemChangeEventArgs)args).Reloading)
            {
                return;
            }

            // handles addition of solutions and projects
            SolutionFolderItem parent = (SolutionFolderItem)args.SolutionItem.ParentFolder;

            if (parent == null)
            {
                return;
            }

            Repository repo = GetRepository(parent);

            if (repo == null)
            {
                return;
            }

            SolutionFolderItem entry       = args.SolutionItem;
            Repository         currentRepo = GetRepository(entry);

            if (currentRepo != null && currentRepo.VersionControlSystem != repo.VersionControlSystem)
            {
                // If the item is already under version control using a different version control system
                // don't add it to the parent repo.
                return;
            }

            string path = entry.BaseDirectory;

            // While we /could/ call repo.Add with `recursive = true', we don't
            // necessarily want to add files under the project/solution directory
            // that may not be a part of this project/solution.

            var files = new HashSet <string> {
                path
            };

            SolutionItemAddFiles(path, entry, files);

            using (ProgressMonitor monitor = GetStatusMonitor()) {
                var status = repo.GetDirectoryVersionInfo(path, false, true);
                foreach (var v in status)
                {
                    if (!v.IsVersioned && files.Contains(v.LocalPath))
                    {
                        repo.Add(v.LocalPath, false, monitor);
                    }
                }
            }

            if (entry is SolutionFolder && files.Count == 1)
            {
                return;
            }

            NotifyFileStatusChanged(new FileUpdateEventArgs(repo, parent.BaseDirectory, true));
        }