本文整理汇总了C#中IGitTfsRemote.QuickFetch方法的典型用法代码示例。如果您正苦于以下问题:C# IGitTfsRemote.QuickFetch方法的具体用法?C# IGitTfsRemote.QuickFetch怎么用?C# IGitTfsRemote.QuickFetch使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IGitTfsRemote
的用法示例。
在下文中一共展示了IGitTfsRemote.QuickFetch方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DoFetch
protected override void DoFetch(IGitTfsRemote remote)
{
if (InitialChangeset.HasValue)
remote.QuickFetch(InitialChangeset.Value);
else
remote.QuickFetch();
}
示例2: DoFetch
protected override void DoFetch(IGitTfsRemote remote, bool stopOnFailMergeCommit)
{
if (InitialChangeset.HasValue)
remote.QuickFetch(InitialChangeset.Value);
else
remote.QuickFetch();
}
示例3: DoFetch
protected override void DoFetch(IGitTfsRemote remote)
{
if (changeSetId == default(int))
// Just grab the latest changeset:
remote.QuickFetch();
else
// Use a specific changeset to start from:
remote.QuickFetch(changeSetId);
}
示例4: DoFetch
protected override void DoFetch(IGitTfsRemote remote, bool stopOnFailMergeCommit)
{
if (InitialChangeset.HasValue)
remote.QuickFetch(InitialChangeset.Value);
else
remote.QuickFetch();
_properties.InitialChangeset = remote.MaxChangesetId;
_properties.PersistAllOverrides();
}
示例5: DoFetch
protected override void DoFetch(IGitTfsRemote remote)
{
if (InitialChangeset.HasValue)
// Just grab the latest changeset:
remote.QuickFetch();
else
// Use a specific changeset to start from:
remote.QuickFetch(InitialChangeset.Value);
}
示例6: DoFetch
protected virtual void DoFetch(IGitTfsRemote remote, bool stopOnFailMergeCommit)
{
if (remote.Repository.IsBare)
{
if(string.IsNullOrEmpty(BareBranch))
throw new GitTfsException("error : specify a git branch to fetch on...");
if (!remote.Repository.HasRef(GitRepository.ShortToLocalName(BareBranch)))
throw new GitTfsException("error : the specified git branch doesn't exist...");
if (!ForceFetch && remote.MaxCommitHash != remote.Repository.GetCommit(BareBranch).Sha)
throw new GitTfsException("error : fetch is not allowed when there is ahead commits!",
new List<string>() {"Remove ahead commits and retry", "use the --force option (ahead commits will be lost!)"});
}
// It is possible that we have outdated refs/remotes/tfs/<id>.
// E.g. someone already fetched changesets from TFS into another git repository and we've pulled it since
// in that case tfs fetch will retrieve same changes again unnecessarily. To prevent it we will scan tree from HEAD and see if newer changesets from
// TFS exists (by checking git-tfs-id mark in commit's comments).
// The process is similar to bootstrapping.
if (!ForceFetch)
globals.Repository.MoveTfsRefForwardIfNeeded(remote);
var exportMetadatasFilePath = Path.Combine(globals.GitDir, "git-tfs_workitem_mapping.txt");
if (ExportMetadatas)
{
remote.ExportMetadatas = true;
remote.Repository.SetConfig(GitTfsConstants.ExportMetadatasConfigKey, "true");
if (!string.IsNullOrEmpty(ExportMetadatasFile))
{
if (File.Exists(ExportMetadatasFile))
{
File.Copy(ExportMetadatasFile, exportMetadatasFilePath);
}
else
throw new GitTfsException("error: the work items mapping file doesn't exist!");
}
}
else
{
if(remote.Repository.GetConfig(GitTfsConstants.ExportMetadatasConfigKey) == "true")
remote.ExportMetadatas = true;
}
remote.ExportWorkitemsMapping = new Dictionary<string, string>();
if (remote.ExportMetadatas && File.Exists(exportMetadatasFilePath))
{
try
{
foreach (var lineRead in File.ReadAllLines(exportMetadatasFilePath))
{
if (string.IsNullOrWhiteSpace(lineRead))
continue;
var values = lineRead.Split('|');
var oldWorkitem = values[0].Trim();
if(!remote.ExportWorkitemsMapping.ContainsKey(oldWorkitem))
remote.ExportWorkitemsMapping.Add(oldWorkitem, values[1].Trim());
}
}
catch (Exception)
{
throw new GitTfsException("error: bad format of workitems mapping file! One line format should be: OldWorkItemId|NewWorkItemId");
}
}
try
{
if (InitialChangeset.HasValue)
{
properties.InitialChangeset = InitialChangeset.Value;
properties.PersistAllOverrides();
remote.QuickFetch(InitialChangeset.Value);
remote.Fetch(stopOnFailMergeCommit);
}
else
{
remote.Fetch(stopOnFailMergeCommit);
}
}
finally
{
Trace.WriteLine("Cleaning...");
remote.CleanupWorkspaceDirectory();
if (remote.Repository.IsBare)
remote.Repository.UpdateRef(GitRepository.ShortToLocalName(BareBranch), remote.MaxCommitHash);
}
}
示例7: DoFetch
protected virtual void DoFetch(IGitTfsRemote remote, bool stopOnFailMergeCommit)
{
var bareBranch = string.IsNullOrEmpty(BareBranch) ? remote.Id : BareBranch;
// It is possible that we have outdated refs/remotes/tfs/<id>.
// E.g. someone already fetched changesets from TFS into another git repository and we've pulled it since
// in that case tfs fetch will retrieve same changes again unnecessarily. To prevent it we will scan tree from HEAD and see if newer changesets from
// TFS exists (by checking git-tfs-id mark in commit's comments).
// The process is similar to bootstrapping.
if (!ForceFetch)
{
if (!remote.Repository.IsBare)
remote.Repository.MoveTfsRefForwardIfNeeded(remote);
else
remote.Repository.MoveTfsRefForwardIfNeeded(remote, bareBranch);
}
if (!ForceFetch &&
remote.Repository.IsBare &&
remote.Repository.HasRef(GitRepository.ShortToLocalName(bareBranch)) &&
remote.MaxCommitHash != remote.Repository.GetCommit(bareBranch).Sha)
{
throw new GitTfsException("error : fetch is not allowed when there is ahead commits!",
new[] {"Remove ahead commits and retry", "use the --force option (ahead commits will be lost!)"});
}
var metadataExportInitializer = new ExportMetadatasInitializer(globals);
bool shouldExport = ExportMetadatas || remote.Repository.GetConfig(GitTfsConstants.ExportMetadatasConfigKey) == "true";
if (ExportMetadatas)
{
metadataExportInitializer.InitializeConfig(remote.Repository, ExportMetadatasFile);
}
metadataExportInitializer.InitializeRemote(remote, shouldExport);
try
{
if (InitialChangeset.HasValue)
{
properties.InitialChangeset = InitialChangeset.Value;
properties.PersistAllOverrides();
remote.QuickFetch(InitialChangeset.Value);
remote.Fetch(stopOnFailMergeCommit);
}
else
{
remote.Fetch(stopOnFailMergeCommit,upToChangeSet);
}
}
finally
{
Trace.WriteLine("Cleaning...");
remote.CleanupWorkspaceDirectory();
if (remote.Repository.IsBare)
remote.Repository.UpdateRef(GitRepository.ShortToLocalName(bareBranch), remote.MaxCommitHash);
}
}
示例8: DoFetch
protected override void DoFetch(IGitTfsRemote remote)
{
remote.QuickFetch();
}