Skip to content

Commit

Permalink
Merge branch 'release/0.20.0'
Browse files Browse the repository at this point in the history
* release/0.20.0:
  Bumped version to 0.20.0
  Fix package icon
  Bump Travis dotnet to 2.1.505 on xenial
  Bump Cake to 0.33.0
  Add return value to CreateBranch alias to avoid unnecessary rounds
  Use Branch category for all branch related aliases
  Use Tags category for all tag related aliases
  Update README.md
  Update file
  Fix for #75: GitLog returns only one commit when using sinceCommitId
  • Loading branch information
devlead committed Jun 22, 2019
2 parents 3bb67a7 + 8b3a1d6 commit 65c9582
Show file tree
Hide file tree
Showing 12 changed files with 49 additions and 26 deletions.
6 changes: 3 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@ os:
- osx
- linux

# Ubuntu 14.04
# Ubuntu 16.04
sudo: required
dist: trusty
dist: xenial

# OS X 10.12
osx_image: xcode9.2

mono:
- 5.12.0

dotnet: 2.1.400
dotnet: 2.1.505

before_install:
- git fetch --unshallow # Travis always does a shallow clone, but GitVersion needs the full history including branches and tags
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[![NuGet](https://img.shields.io/nuget/v/Cake.Git.svg)](https://www.nuget.org/packages/Cake.Git) [![MyGet](https://img.shields.io/myget/cake-contrib/vpre/Cake.Git.svg?label=MyGet)](https://www.myget.org/feed/wcomab/package/nuget/Cake.Git)

Cake AddIn that extends Cake with Git features using LibGit2 and LibGit2Sharp
Cake AddIn that extends Cake with Git features using LibGit2 and LibGit2Sharp.

| Build server | Platform | Status |
|-----------------------------|--------------|---------------------------------------------------------------------------------------------------------------------------|
Expand All @@ -11,7 +11,7 @@ Cake AddIn that extends Cake with Git features using LibGit2 and LibGit2Sharp

## Documentation

Documentation available at [cakebuild.net/dsl/git](http://cakebuild.net/dsl/git)
Documentation is available at [cakebuild.net/dsl/git](http://cakebuild.net/dsl/git).

## Example usage
```cake
Expand Down
7 changes: 7 additions & 0 deletions ReleaseNotes.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
### New in 0.20.0 (Released 2019/06/22)

* Bumped Cake.Core to 0.33.0
* GitCreateBranch returns GitBranch
* Fix GitLog
* Unify tags documentation

### New in 0.19.0 (Released 2018/08/23)

* Ported to .NET Standard 2.0
Expand Down
2 changes: 1 addition & 1 deletion build.cake
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ var nuGetPackSettings = new NuGetPackSettings {
Description = assemblyInfo.Description,
Summary = "Cake AddIn that extends Cake with Git SCM features",
ProjectUrl = new Uri("https://github.com/cake-contrib/Cake_Git/"),
IconUrl = new Uri("https://cdn.rawgit.com/cake-contrib/graphics/a5cf0f881c390650144b2243ae551d5b9f836196/png/cake-contrib-medium.png"),
IconUrl = new Uri("https://cdn.jsdelivr.net/gh/cake-contrib/graphics/png/cake-contrib-medium.png"),
LicenseUrl = new Uri("https://github.com/cake-contrib/Cake_Git/blob/master/LICENSE.md"),
Copyright = assemblyInfo.Copyright,
ReleaseNotes = releaseNotes.Notes.ToArray(),
Expand Down
4 changes: 1 addition & 3 deletions src/Cake.Git/Cake.Git.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@
<ProjectGuid>{08F0A5C3-0E9C-451D-B003-14FF73699BE1}</ProjectGuid>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Cake.Core" Version="0.28.1">
<PrivateAssets>All</PrivateAssets>
</PackageReference>
<PackageReference Include="Cake.Core" Version="0.33.0" PrivateAssets="All" />
<PackageReference Include="LibGit2Sharp" Version="0.25.2" />
<PackageReference Include="LibGit2Sharp.NativeBinaries" Version="1.0.217" />
</ItemGroup>
Expand Down
13 changes: 9 additions & 4 deletions src/Cake.Git/GitAliases.Branch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,7 @@ public static GitBranch GitBranchCurrent(this ICakeContext context, DirectoryPat
/// </code>
/// </example>
[CakeMethodAlias]
[CakeAliasCategory("CreateBranch")]
public static void GitCreateBranch(this ICakeContext context, DirectoryPath repositoryDirectoryPath, string branchName, bool checkOut)
public static GitBranch GitCreateBranch(this ICakeContext context, DirectoryPath repositoryDirectoryPath, string branchName, bool checkOut)
{
if (context == null)
{
Expand All @@ -85,13 +84,19 @@ public static void GitCreateBranch(this ICakeContext context, DirectoryPath repo
throw new ArgumentNullException(nameof(branchName));
}

context.UseRepository(repositoryDirectoryPath,
return context.UseRepository(repositoryDirectoryPath,
repository =>
{
var localBranch = repository.CreateBranch(branchName);

if (checkOut) Commands.Checkout(repository, localBranch);
if (checkOut)
{
Commands.Checkout(repository, localBranch);
}

return new GitBranch(repository);
});

}
}
}
2 changes: 1 addition & 1 deletion src/Cake.Git/GitAliases.Log.cs
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ string sinceCommitId
return repository.Commits
.QueryBy(new CommitFilter
{
IncludeReachableFrom = sinceCommitId,
IncludeReachableFrom = repository.Head,
ExcludeReachableFrom = repository.Lookup<Commit>(sinceCommitId).Parents
})
.Select(commit => new GitCommit(commit))
Expand Down
2 changes: 1 addition & 1 deletion src/Cake.Git/GitAliases.Tag.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public static partial class GitAliases
/// <param name="tagName">The tag name.</param>
/// <exception cref="ArgumentNullException"></exception>
[CakeMethodAlias]
[CakeAliasCategory("Tag")]
[CakeAliasCategory("Tags")]
public static void GitTag(
this ICakeContext context,
DirectoryPath repositoryDirectoryPath,
Expand Down
2 changes: 1 addition & 1 deletion src/Cake.Git/GitAliases.Tags.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ partial class GitAliases
/// <param name="repositoryDirectoryPath"></param>
/// <exception cref="ArgumentNullException"></exception>
[CakeMethodAlias]
[CakeAliasCategory("AllTags")]
[CakeAliasCategory("Tags")]
public static List<Tag> GitTags(
this ICakeContext context,
DirectoryPath repositoryDirectoryPath)
Expand Down
8 changes: 4 additions & 4 deletions src/SolutionInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
[assembly: AssemblyDescription("Cake Git AddIn")]
[assembly: AssemblyCompany("WCOM AB")]
[assembly: AssemblyProduct("Cake.Git")]
[assembly: AssemblyVersion("0.19.0")]
[assembly: AssemblyFileVersion("0.19.0")]
[assembly: AssemblyInformationalVersion("0.19.0")]
[assembly: AssemblyCopyright("Copyright © WCOM AB 2018")]
[assembly: AssemblyVersion("0.20.0")]
[assembly: AssemblyFileVersion("0.20.0")]
[assembly: AssemblyInformationalVersion("0.20.0")]
[assembly: AssemblyCopyright("Copyright © WCOM AB 2019")]
[assembly: CLSCompliant(true)]

21 changes: 17 additions & 4 deletions test.cake
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,17 @@ Task("Git-Init-Commit")
Information("Commit created:\r\n{0}", initalCommit);
});

Task("Git-Second-Commit")
.IsDependentOn("Git-Init-Commit")
.Does(() =>
{
var filePath = testInitalRepo.CombineWithFilePath(string.Format("{0}.new", Guid.NewGuid()));
CreateRandomDataFile(Context, filePath);
GitAdd(testInitalRepo, filePath);
var secondCommit = GitCommit(testInitalRepo, testUser, testUserEmail, "Second commit");
Information("Commit created:\r\n{0}", secondCommit);
});

Task("Git-HasUncommitedChanges-Dirty")
.IsDependentOn("Git-Init-Add")
.Does(() =>
Expand Down Expand Up @@ -223,9 +234,9 @@ Task("Git-Init-Diff")
});

Task("Git-Log-TipToCommitId")
.IsDependentOn("Git-Init-Commit")
.IsDependentOn("Git-Second-Commit")
.Does(() =>
{
{
var commits = GitLog(testInitalRepo, initalCommit.Sha);
foreach(var commit in commits)
{
Expand Down Expand Up @@ -669,10 +680,12 @@ Task("Git-Create-Branch")
.Does(() =>
{
var branchName = "Foo";
GitCreateBranch(testInitalRepo, branchName, true);
var createdBranch = GitCreateBranch(testInitalRepo, branchName, true);
if (createdBranch.FriendlyName != branchName)
throw new Exception($"Incorrect Branch returned. Expected {branchName} and got {createdBranch.FriendlyName}");
var branch = GitBranchCurrent(testInitalRepo);
if (branch.FriendlyName != branchName)
throw new Exception($"Incorrect Branch created. Expected {branchName} and got {branch.FriendlyName}");
throw new Exception($"Incorrect Branch created. Expected {branchName} and got {branch.FriendlyName}");
});

Task("Git-Remote-Branch")
Expand Down
4 changes: 2 additions & 2 deletions tools/packages.config
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Cake" version="0.28.1" />
<package id="Cake.CoreCLR" version="0.28.1" />
<package id="Cake" version="0.33.0" />
<package id="Cake.CoreCLR" version="0.33.0" />
</packages>

0 comments on commit 65c9582

Please sign in to comment.