本文整理汇总了C#中IGitTfsRemote类的典型用法代码示例。如果您正苦于以下问题:C# IGitTfsRemote类的具体用法?C# IGitTfsRemote怎么用?C# IGitTfsRemote使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IGitTfsRemote类属于命名空间,在下文中一共展示了IGitTfsRemote类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DescribeTfsRemotes
private void DescribeTfsRemotes(IGitTfsRemote remote)
{
// add a line of whitespace to improve readability
stdout.WriteLine();
stdout.WriteLine("remote tfs id: '{0}' {1} {2}", remote.Id, remote.TfsUrl, remote.TfsRepositoryPath);
stdout.WriteLine(" {0} - {1} @ {2}", remote.RemoteRef, remote.MaxCommitHash, remote.MaxChangesetId);
}
示例2: InitializeRemote
/// <summary>
/// Configures a IGitTfsRemote to export metadata
/// </summary>
/// <param name="remote"></param>
/// <param name="shouldExportMetadata"></param>
public void InitializeRemote(IGitTfsRemote remote, bool shouldExportMetadata)
{
remote.ExportMetadatas = shouldExportMetadata;
remote.ExportWorkitemsMapping = new Dictionary<string, string>();
if (shouldExportMetadata && 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");
}
}
}
示例3: DoFetch
protected override void DoFetch(IGitTfsRemote remote, bool stopOnFailMergeCommit)
{
if (InitialChangeset.HasValue)
remote.QuickFetch(InitialChangeset.Value);
else
remote.QuickFetch();
}
示例4: DoFetch
protected override void DoFetch(IGitTfsRemote remote)
{
if (InitialChangeset.HasValue)
remote.QuickFetch(InitialChangeset.Value);
else
remote.QuickFetch();
}
示例5: GetChangesets
public IEnumerable<ITfsChangeset> GetChangesets(string path, long startVersion, IGitTfsRemote remote, long lastVersion = -1, bool byLots = false)
{
if (!_script.Changesets.Any(c => c.IsBranchChangeset) && _script.Changesets.Any(c => c.IsMergeChangeset))
return _script.Changesets.Where(x => x.Id >= startVersion).Select(x => BuildTfsChangeset(x, remote));
return _script.Changesets
.Where(x => x.Id >= startVersion && x.Changes.Any(c => c.RepositoryPath.ToLower().IndexOf(path.ToLower()) == 0 || path.ToLower().IndexOf(c.RepositoryPath.ToLower()) == 0))
.Select(x => BuildTfsChangeset(x, remote));
}
示例6: TfsWorkspace
public TfsWorkspace(Workspace workspace, string localDirectory, TextWriter stdout, TfsChangesetInfo contextVersion, IGitTfsRemote remote)
{
_workspace = workspace;
_contextVersion = contextVersion;
_remote = remote;
_localDirectory = localDirectory;
_stdout = stdout;
}
示例7: 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);
}
示例8: 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();
}
示例9: GetChangesets
public IEnumerable<ITfsChangeset> GetChangesets(string path, int startVersion, IGitTfsRemote remote, int lastVersion = -1, bool byLots = false)
{
if (!_script.Changesets.Any(c => c.IsBranchChangeset) && _script.Changesets.Any(c => c.IsMergeChangeset))
return _script.Changesets.Where(x => x.Id >= startVersion).Select(x => BuildTfsChangeset(x, remote));
var branchPath = path + "/";
return _script.Changesets
.Where(x => x.Id >= startVersion && x.Changes.Any(c => c.RepositoryPath.IndexOf(branchPath, StringComparison.CurrentCultureIgnoreCase) == 0 || branchPath.IndexOf(c.RepositoryPath, StringComparison.CurrentCultureIgnoreCase) == 0))
.Select(x => BuildTfsChangeset(x, remote));
}
示例10: 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);
}
示例11: DoFetch
protected virtual void DoFetch(IGitTfsRemote remote)
{
// 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.
globals.Repository.MoveTfsRefForwardIfNeeded(remote);
remote.Fetch();
}
示例12: TfsWorkspace
public TfsWorkspace(IWorkspace workspace, string localDirectory, TextWriter stdout, TfsChangesetInfo contextVersion, IGitTfsRemote remote, CheckinOptions checkinOptions, ITfsHelper tfsHelper)
{
_workspace = workspace;
_contextVersion = contextVersion;
_remote = remote;
_checkinOptions = checkinOptions;
_tfsHelper = tfsHelper;
_localDirectory = localDirectory;
_stdout = stdout;
}
示例13: InitMocks4Tests
private void InitMocks4Tests(out IGitRepository gitRepository, out IGitTfsRemote remote)
{
// mock git repository
gitRepository = _mocks.Get<IGitRepository>();
gitRepository.Stub(r => r.HasRemote(Arg<string>.Is.Anything)).Return(true);
_mocks.Get<Globals>().Repository = gitRepository;
// mock tfs remote
_mocks.Get<Globals>().UserSpecifiedRemoteId = "default";
remote = MockRepository.GenerateStub<IGitTfsRemote>();
gitRepository.Stub(r => r.ReadTfsRemote(Arg<string>.Is.Anything)).Return(remote);
}
示例14: CreateLabelsForTfsBranch
private int CreateLabelsForTfsBranch(IGitTfsRemote tfsRemote)
{
if (string.IsNullOrWhiteSpace(NameFilter))
NameFilter = null;
else
NameFilter = NameFilter.Trim();
UpdateRemote(tfsRemote);
_stdout.WriteLine("Looking for label on " + tfsRemote.TfsRepositoryPath + "...");
var labels = tfsRemote.Tfs.GetLabels(tfsRemote.TfsRepositoryPath, NameFilter);
_stdout.WriteLine(labels.Count() +" labels found!");
Regex exludeRegex = null;
if (ExcludeNameFilter != null)
exludeRegex = new Regex(ExcludeNameFilter);
foreach (var label in labels)
{
if (ExcludeNameFilter != null && exludeRegex.IsMatch(label.Name))
continue;
Trace.WriteLine("LabelId:" + label.Id + "/ChangesetId:" + label.ChangesetId + "/LabelName:" + label.Name + "/Owner:" + label.Owner);
Trace.WriteLine("Try to find changeset in git repository...");
string sha1TagCommit = _globals.Repository.FindCommitHashByChangesetId(label.ChangesetId);
if (string.IsNullOrWhiteSpace(sha1TagCommit))
{
Trace.WriteLine("This label does not match an existing commit...");
continue;
}
Trace.WriteLine("Commit found! sha1 : " + sha1TagCommit);
string ownerName;
string ownerEmail;
if(_authors.Authors.ContainsKey(label.Owner))
{
var author = _authors.Authors[label.Owner];
ownerName = author.Name;
ownerEmail = author.Email;
}
else
{
ownerName = label.Owner;
ownerEmail = label.Owner;
}
var labelName = (label.IsTransBranch ? label.Name + "(" + tfsRemote.Id + ")" : label.Name).ToGitRefName();
_stdout.WriteLine("Writing label '" + labelName + "'...");
_globals.Repository.CreateTag(labelName, sha1TagCommit, label.Comment, ownerName, ownerEmail ,label.Date);
}
return GitTfsExitCodes.OK;
}
示例15: InitMocks4Tests
private void InitMocks4Tests(string gitBranchToInit, out IGitRepository gitRepository, out IGitTfsRemote remote, out IGitTfsRemote newBranchRemote)
{
gitRepository = mocks.Get<IGitRepository>();
mocks.Get<Globals>().Repository = gitRepository;
mocks.Get<Globals>().GitDir = ".git";
remote = MockRepository.GenerateStub<IGitTfsRemote>();
remote.TfsUsername = "user";
remote.TfsPassword = "pwd";
remote.TfsRepositoryPath = "$/MyProject/Trunk";
remote.TfsUrl = "http://myTfsServer:8080/tfs";
remote.Tfs = new VsFake.TfsHelper(mocks.Container, null, null);
gitRepository.Stub(r => r.GitDir).Return(".");
newBranchRemote = MockRepository.GenerateStub<IGitTfsRemote>();
newBranchRemote.Id = gitBranchToInit;
}