コード例 #1
0
        public IEnumerable <RevisionRange> GetFromTillHead(DateTime from, int pageSize)
        {
            var command = new LogCommand().WithAdditionalArgument("-d >{0:yyyy-MM-dd}".Fmt(from));
            var pages   = _repository.Log(command)
                          .Where(ch => ch.Timestamp >= from)
                          .OrderBy(ch => ch.Timestamp)
                          .ToArray()
                          .Split(pageSize);

            var result = pages.Select(page => new RevisionRange(page.First().ToRevisionId(), page.Last().ToRevisionId()));

            return(result);
        }
コード例 #2
0
        public override string Commit(string filePath, string changedContent, string commitComment)
        {
            using (var file = File.OpenWrite(Path.Combine(ClonedRepoFolder, filePath)))
            {
                var changes = new UTF8Encoding(true).GetBytes(changedContent);
                file.Write(changes, 0, changes.Length);
            }

            _repositiory.Add(new AddCommand().WithPaths(filePath));
            _repositiory.Commit(commitComment, new CommitCommand().WithOverrideAuthor("test"));
            _repositiory.Push();

            var lastChangeset = _repositiory.Log().First();

            return(lastChangeset.Revision);
        }