GetCommitComment() static private method

static private GetCommitComment ( string file ) : string
file string
return string
Exemplo n.º 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);
        }
Exemplo n.º 2
0
        public static bool Commit(VersionControlItemList items, bool test)
        {
            if (items.Count != 1)
            {
                return(false);
            }

            VersionControlItem item = items [0];

            if (item.VersionInfo.CanCommit)
            {
                if (test)
                {
                    return(true);
                }
                ChangeSet cset = item.Repository.CreateChangeSet(item.Path);
                cset.GlobalComment = VersionControlService.GetCommitComment(cset.BaseLocalPath);

                foreach (VersionInfo vi in item.Repository.GetDirectoryVersionInfo(item.Path, false, true))
                {
                    if (vi.HasLocalChanges)
                    {
                        cset.AddFile(vi);
                    }
                }
                if (!cset.IsEmpty)
                {
                    Commit(item.Repository, cset, false);
                }
                else
                {
                    MessageService.ShowMessage(GettextCatalog.GetString("There are no changes to be committed."));
                    return(false);
                }
            }
            return(false);
        }