本文整理汇总了C#中VersionControlItemList.SplitByRepository方法的典型用法代码示例。如果您正苦于以下问题:C# VersionControlItemList.SplitByRepository方法的具体用法?C# VersionControlItemList.SplitByRepository怎么用?C# VersionControlItemList.SplitByRepository使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VersionControlItemList
的用法示例。
在下文中一共展示了VersionControlItemList.SplitByRepository方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Commit
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 ();
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 (item.Path.IsDirectory) {
// We don't run checks for directories, we throw dialog if there are no changes.
if (test)
return true;
foreach (VersionInfo vi in repo.GetDirectoryVersionInfo (item.Path, false, true))
if (vi.HasLocalChanges) {
filesToCommit++;
cset.AddFile (vi);
}
} else {
VersionInfo vi = repo.GetVersionInfo (item.Path);
if (vi.HasLocalChanges) {
if (test)
return true;
filesToCommit++;
cset.AddFile (vi);
}
}
}
// In case of no local changes.
if (test)
return false;
if (!cset.IsEmpty) {
Commit (repo, cset, false);
} else {
MessageService.ShowMessage (GettextCatalog.GetString ("There are no changes to be committed."));
continue;
}
}
return filesToCommit != 0;
}