CreateChangeSet() public method

public CreateChangeSet ( FilePath basePath ) : MonoDevelop.VersionControl.ChangeSet
basePath FilePath
return MonoDevelop.VersionControl.ChangeSet
コード例 #1
0
        public static bool Commit(VersionControlItemList items, bool test)
        {
            int filesToCommit = 0;

            VersionControlItemList[] itemListsByRepo = items.SplitByRepository();

            foreach (VersionControlItemList itemList in itemListsByRepo)
            {
                // Generate base folder path.
                FilePath basePath = itemList.FindMostSpecificParent(FilePath.Null);

                Repository repo = itemList.First().Repository;

                ChangeSet cset = repo.CreateChangeSet(basePath);
                cset.GlobalComment = VersionControlService.GetCommitComment(cset.BaseLocalPath);

                foreach (var item in itemList)
                {
                    if (!item.VersionInfo.CanCommit)
                    {
                        continue;
                    }

                    if (test)
                    {
                        return(true);
                    }

                    foreach (VersionInfo vi in repo.GetDirectoryVersionInfo(item.Path, false, true))
                    {
                        if (vi.HasLocalChanges)
                        {
                            filesToCommit++;
                            if (test)
                            {
                                continue;
                            }

                            cset.AddFile(vi);
                        }
                    }
                }

                if (!cset.IsEmpty)
                {
                    Commit(repo, cset, false);
                }
                else if (!test)
                {
                    MessageService.ShowMessage(GettextCatalog.GetString("There are no changes to be committed."));
                    continue;
                }
            }
            return(filesToCommit != 0);
        }
コード例 #2
0
        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);
        }