本文整理汇总了C#中Commit类的典型用法代码示例。如果您正苦于以下问题:C# Commit类的具体用法?C# Commit怎么用?C# Commit使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Commit类属于命名空间,在下文中一共展示了Commit类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: ScanCommitMessagesForReleaseNotes
public SemanticReleaseNotes ScanCommitMessagesForReleaseNotes(GitReleaseNotesArguments arguments, Commit[] commitsToScan)
{
var repoParts = arguments.Repo.Split('/');
var organisation = repoParts[0];
var repository = repoParts[1];
var issueNumbersToScan = _issueNumberExtractor.GetIssueNumbers(arguments, commitsToScan, @"#(?<issueNumber>\d+)");
var since = commitsToScan.Select(c=>c.Author.When).Min();
var potentialIssues = _gitHubClient.Issue.GetForRepository(organisation, repository, new RepositoryIssueRequest
{
Filter = IssueFilter.All,
Since = since,
State = ItemState.Closed
}).Result;
var closedMentionedIssues = potentialIssues
.Where(i => issueNumbersToScan.Contains(i.Number.ToString(CultureInfo.InvariantCulture)))
.ToArray();
return new SemanticReleaseNotes(closedMentionedIssues.Select(i=>
{
var labels = i.Labels == null ? new string[0] : i.Labels.Select(l=>l.Name).ToArray();
return new ReleaseNoteItem(i.Title, string.Format("#{0}", i.Number), i.HtmlUrl, labels);
}));
}
开发者ID:reavowed,项目名称:GitReleaseNotes,代码行数:26,代码来源:GitHubIssueTracker.cs
示例2: GetCommits
/// <summary>
/// Get all the commits in a CVS log ordered by date.
/// </summary>
public IEnumerable<Commit> GetCommits()
{
var lookup = new Dictionary<string, Commit>();
using (var commitsByMessage = new CommitsByMessage(m_log))
{
foreach (var revision in m_fileRevisions)
{
if (revision.IsAddedOnAnotherBranch)
{
revision.File.BranchAddedOn = GetBranchAddedOn(revision.Message);
}
else if (revision.CommitId.Length == 0)
{
commitsByMessage.Add(revision);
}
else
{
Commit commit;
if (lookup.TryGetValue(revision.CommitId, out commit))
{
commit.Add(revision);
}
else
{
commit = new Commit(revision.CommitId) { revision };
lookup.Add(commit.CommitId, commit);
}
}
}
return lookup.Values.Concat(commitsByMessage.Resolve()).OrderBy(c => c.Time).ToList();
}
}
开发者ID:runt18,项目名称:CvsntGitImporter,代码行数:36,代码来源:CommitBuilder.cs
示例3: Commit
public virtual void Commit(Commit attempt)
{
lock (this.commits)
{
if (this.commits.Contains(attempt))
throw new DuplicateCommitException();
if (this.commits.Any(c => c.StreamId == attempt.StreamId && c.StreamRevision == attempt.StreamRevision))
throw new ConcurrencyException();
this.stamps[attempt.CommitId] = attempt.CommitStamp;
this.commits.Add(attempt);
lock (this.undispatched)
this.undispatched.Add(attempt);
lock (this.heads)
{
var head = this.heads.FirstOrDefault(x => x.StreamId == attempt.StreamId);
this.heads.Remove(head);
var snapshotRevision = head == null ? 0 : head.SnapshotRevision;
this.heads.Add(new StreamHead(attempt.StreamId, attempt.StreamRevision, snapshotRevision));
}
}
}
开发者ID:Jeff-Lewis,项目名称:EventStore,代码行数:25,代码来源:InMemoryPersistenceEngine.cs
示例4: Commit
public virtual void Commit(Commit attempt)
{
if (!attempt.IsValid() || attempt.IsEmpty())
{
Logger.Debug(Resources.CommitAttemptFailedIntegrityChecks);
return;
}
foreach (var hook in _pipelineHooks)
{
Logger.Debug(Resources.InvokingPreCommitHooks, attempt.CommitId, hook.GetType());
if (hook.PreCommit(attempt))
{
continue;
}
Logger.Info(Resources.CommitRejectedByPipelineHook, hook.GetType(), attempt.CommitId);
return;
}
Logger.Info(Resources.CommittingAttempt, attempt.CommitId, attempt.Events.Count);
_persistence.Commit(attempt);
foreach (var hook in _pipelineHooks)
{
Logger.Debug(Resources.InvokingPostCommitPipelineHooks, attempt.CommitId, hook.GetType());
hook.PostCommit(attempt);
}
}
开发者ID:jamescrowley,项目名称:NEventStore,代码行数:29,代码来源:OptimisticEventStore.cs
示例5: AppendVersion
private static void AppendVersion(Commit commit, int index)
{
var busMessage = commit.Events[index].Body as IMessage;
busMessage.SetHeader(AggregateIdKey, commit.StreamId.ToString());
busMessage.SetHeader(CommitVersionKey, commit.StreamRevision.ToString());
busMessage.SetHeader(EventVersionKey, GetSpecificEventVersion(commit, index).ToString());
}
开发者ID:MattCollinge,项目名称:EventStore-Performance-Tests,代码行数:7,代码来源:NServiceBusDispatcher.cs
示例6: Commit
public virtual void Commit(Commit attempt)
{
this.ThrowWhenDisposed();
Logger.Debug(Resources.AttemptingToCommit, attempt.CommitId, attempt.StreamId, attempt.CommitSequence);
lock (Commits)
{
if (Commits.Contains(attempt))
throw new DuplicateCommitException();
if (Commits.Any(c => c.StreamId == attempt.StreamId && c.StreamRevision == attempt.StreamRevision))
throw new ConcurrencyException();
Stamps[attempt.CommitId] = attempt.CommitStamp;
Commits.Add(attempt);
Undispatched.Add(attempt);
var head = Heads.FirstOrDefault(x => x.StreamId == attempt.StreamId);
Heads.Remove(head);
Logger.Debug(Resources.UpdatingStreamHead, attempt.StreamId);
var snapshotRevision = head == null ? 0 : head.SnapshotRevision;
Heads.Add(new StreamHead(attempt.StreamId, attempt.StreamRevision, snapshotRevision));
}
}
开发者ID:JeetKunDoug,项目名称:EventStore,代码行数:25,代码来源:InMemoryPersistenceEngine.cs
示例7: Context
protected override void Context()
{
alreadyCommitted = BuildCommitStub(HeadStreamRevision, HeadCommitSequence);
beyondEndOfStream = BuildCommitStub(BeyondEndOfStreamRevision, HeadCommitSequence + 1);
hook.PostCommit(alreadyCommitted);
}
开发者ID:jamescrowley,项目名称:NEventStore,代码行数:7,代码来源:OptimisticCommitHookTests.cs
示例8: ToGitObject
public IStorableObject ToGitObject(Repository repo, string sha)
{
using (GitObjectReader objectReader = new GitObjectReader(Content))
{
IStorableObject obj;
switch (Type)
{
case ObjectType.Commit:
obj = new Commit(repo, sha);
break;
case ObjectType.Tree:
obj = new Tree(repo, sha);
break;
case ObjectType.Blob:
obj = new Blob(repo, sha);
break;
case ObjectType.Tag:
obj = new Tag(repo, sha);
break;
default:
throw new NotImplementedException();
}
obj.Deserialize(objectReader);
return obj;
}
}
开发者ID:skinny,项目名称:dotgit,代码行数:27,代码来源:Undeltified.cs
示例9: DeploymentsClientTests
public DeploymentsClientTests()
{
var github = Helper.GetAuthenticatedClient();
_deploymentsClient = github.Repository.Deployment;
_context = github.CreateRepositoryContext("public-repo").Result;
var blob = new NewBlob
{
Content = "Hello World!",
Encoding = EncodingType.Utf8
};
var blobResult = github.Git.Blob.Create(_context.RepositoryOwner, _context.RepositoryName, blob).Result;
var newTree = new NewTree();
newTree.Tree.Add(new NewTreeItem
{
Type = TreeType.Blob,
Mode = FileMode.File,
Path = "README.md",
Sha = blobResult.Sha
});
var treeResult = github.Git.Tree.Create(_context.RepositoryOwner, _context.RepositoryName, newTree).Result;
var newCommit = new NewCommit("test-commit", treeResult.Sha);
_commit = github.Git.Commit.Create(_context.RepositoryOwner, _context.RepositoryName, newCommit).Result;
}
开发者ID:cloudRoutine,项目名称:octokit.net,代码行数:28,代码来源:DeploymentsClientTests.cs
示例10: SingleBranch_PlaysInSequence
public void SingleBranch_PlaysInSequence()
{
var now = DateTime.Now;
var file1 = new FileInfo("file1");
var file2 = new FileInfo("file2").WithBranch("branch", "1.1.0.2");
var commit0 = new Commit("id0") { Index = 1 }
.WithRevision(file1, "1.1", time: now)
.WithRevision(file2, "1.1", time: now);
var commit1 = new Commit("id1") { Index = 2 }
.WithRevision(file1, "1.2", time: now + TimeSpan.FromMinutes(2))
.WithRevision(file2, "1.2", time: now + TimeSpan.FromMinutes(2), mergepoint: "1.1.2.1");
var commit2 = new Commit("branch0") { Index = 3 }
.WithRevision(file2, "1.1.2.1", time: now + TimeSpan.FromMinutes(1));
var commits = new[] { commit0, commit1, commit2 };
var branchpoints = new Dictionary<string, Commit>()
{
{ "branch", commit0 }
};
var branches = new BranchStreamCollection(commits, branchpoints);
commit1.MergeFrom = commit2;
var player = new CommitPlayer(MockRepository.GenerateStub<ILogger>(), branches);
var result = player.Play().Select(c => c.CommitId).ToList();
Assert.IsTrue(result.SequenceEqual("id0", "branch0", "id1"));
}
开发者ID:runt18,项目名称:CvsntGitImporter,代码行数:30,代码来源:CommitPlayerTest.cs
示例11: Select
public virtual Commit Select(Commit committed)
{
foreach (var eventMessage in committed.Events)
eventMessage.Body = this.Convert(eventMessage.Body);
return committed;
}
开发者ID:seejee,项目名称:EventStore,代码行数:7,代码来源:EventUpconverterPipelineHook.cs
示例12: CreateCommit
public String CreateCommit()
{
var reader = new StreamReader(Request.InputStream);
var data = reader.ReadToEnd();
reader.Close();
var dataValue = ParsePostData(data);
var userId = dataValue["userId"];
var repositoryId = int.Parse(dataValue["repositoryId"]);
var message = dataValue["message"];
Guid userGuid;
if (!IsUserAuthenticated(userId, out userGuid))
return null;
var repository = DataManager.GetInstance().GetRepository(repositoryId);
if (!repository.Owner.Equals(UserManager.GetInstance().GetUser(userGuid)))
return null;
if (String.IsNullOrWhiteSpace(message))
return null;
var commit = new Commit(UserManager.GetInstance().GetUser(userGuid), message);
var newCommit = DataManager.GetInstance().AddCommit(commit, repository);
var commitPath = GetTempCommitPath(repository, newCommit.Id);
Directory.CreateDirectory(commitPath);
return newCommit.Id.ToString(CultureInfo.InvariantCulture);
}
开发者ID:Gvin,项目名称:Diplom,代码行数:28,代码来源:DesktopApiController.cs
示例13: PreCommit
public virtual bool PreCommit(Commit attempt)
{
Logger.Debug(Resources.OptimisticConcurrencyCheck, attempt.StreamId);
Commit head = GetStreamHead(attempt.StreamId);
if (head == null)
{
return true;
}
if (head.CommitSequence >= attempt.CommitSequence)
{
throw new ConcurrencyException();
}
if (head.StreamRevision >= attempt.StreamRevision)
{
throw new ConcurrencyException();
}
if (head.CommitSequence < attempt.CommitSequence - 1)
{
throw new StorageException(); // beyond the end of the stream
}
if (head.StreamRevision < attempt.StreamRevision - attempt.Events.Count)
{
throw new StorageException(); // beyond the end of the stream
}
Logger.Debug(Resources.NoConflicts, attempt.StreamId);
return true;
}
开发者ID:jamescrowley,项目名称:NEventStore,代码行数:33,代码来源:OptimisticPipelineHook.cs
示例14: DeploymentsClientTests
public DeploymentsClientTests()
{
var gitHubClient = Helper.GetAuthenticatedClient();
_deploymentsClient = gitHubClient.Repository.Deployment;
var newRepository = new NewRepository(Helper.MakeNameWithTimestamp("public-repo"))
{
AutoInit = true
};
_repository = gitHubClient.Repository.Create(newRepository).Result;
_repositoryOwner = _repository.Owner.Login;
var blob = new NewBlob
{
Content = "Hello World!",
Encoding = EncodingType.Utf8
};
var blobResult = gitHubClient.GitDatabase.Blob.Create(_repositoryOwner, _repository.Name, blob).Result;
var newTree = new NewTree();
newTree.Tree.Add(new NewTreeItem
{
Type = TreeType.Blob,
Mode = FileMode.File,
Path = "README.md",
Sha = blobResult.Sha
});
var treeResult = gitHubClient.GitDatabase.Tree.Create(_repositoryOwner, _repository.Name, newTree).Result;
var newCommit = new NewCommit("test-commit", treeResult.Sha);
_commit = gitHubClient.GitDatabase.Commit.Create(_repositoryOwner, _repository.Name, newCommit).Result;
}
开发者ID:cH40z-Lord,项目名称:octokit.net,代码行数:35,代码来源:DeploymentsClientTests.cs
示例15: Dispatch
public virtual void Dispatch(Commit commit)
{
ThreadPool.QueueUserWorkItem(state =>
{
this.bus.Publish(commit);
this.persistence.MarkCommitAsDispatched(commit);
});
}
开发者ID:Jeff-Lewis,项目名称:EventStore,代码行数:8,代码来源:AsynchronousDispatcher.cs
示例16: Commit
public virtual void Commit(Commit attempt)
{
var clock = Stopwatch.StartNew();
this.persistence.Commit(attempt);
clock.Stop();
this.counters.CountCommit(attempt.Events.Count, clock.ElapsedMilliseconds);
}
开发者ID:JohnLou,项目名称:EventStore,代码行数:8,代码来源:PerformanceCounterPersistenceEngine.cs
示例17: Block
public Block(int startLine, int lineCount, Commit commit, string fileName, int originalStartLine)
{
m_startLine = startLine;
m_lineCount = lineCount;
m_commit = commit;
m_fileName = fileName;
m_originalStartLine = originalStartLine;
}
开发者ID:bgrainger,项目名称:GitBlame,代码行数:8,代码来源:Block.cs
示例18: AfterRebaseStepInfo
internal AfterRebaseStepInfo(RebaseStepInfo stepInfo, Commit commit, long completedStepIndex, long totalStepCount)
{
StepInfo = stepInfo;
Commit = commit;
WasPatchAlreadyApplied = false;
CompletedStepIndex = completedStepIndex;
TotalStepCount = totalStepCount;
}
开发者ID:PKRoma,项目名称:libgit2sharp,代码行数:8,代码来源:AfterRebaseStepInfo.cs
示例19: MergedFiles_None
public void MergedFiles_None()
{
var commit = new Commit("abc")
.WithRevision(m_f1, "1.2");
var result = commit.MergedFiles;
Assert.IsFalse(result.Any());
}
开发者ID:runt18,项目名称:CvsntGitImporter,代码行数:8,代码来源:CommitTest.cs
示例20: AddEventsOrClearOnSnapshot
public static void AddEventsOrClearOnSnapshot(
this ICollection<object> events, Commit commit, bool applySnapshot)
{
if (applySnapshot && commit.Snapshot != null)
events.Clear();
else
events.AddEvents(commit);
}
开发者ID:RoystonS,项目名称:EventStore,代码行数:8,代码来源:ExtensionMethods.cs
注:本文中的Commit类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论