diff --git a/.travis.yml b/.travis.yml index d83da49..ce3eff3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,9 +3,9 @@ os: - osx - linux -# Ubuntu 14.04 +# Ubuntu 16.04 sudo: required -dist: trusty +dist: xenial # OS X 10.12 osx_image: xcode9.2 @@ -13,7 +13,7 @@ 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 diff --git a/README.md b/README.md index 4d1286a..a077a4a 100644 --- a/README.md +++ b/README.md @@ -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 | |-----------------------------|--------------|---------------------------------------------------------------------------------------------------------------------------| @@ -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 diff --git a/ReleaseNotes.md b/ReleaseNotes.md index 1ef705a..cc62bc5 100644 --- a/ReleaseNotes.md +++ b/ReleaseNotes.md @@ -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 diff --git a/build.cake b/build.cake index 8b7d897..62e3e89 100644 --- a/build.cake +++ b/build.cake @@ -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(), diff --git a/src/Cake.Git/Cake.Git.csproj b/src/Cake.Git/Cake.Git.csproj index 730e584..c65528c 100644 --- a/src/Cake.Git/Cake.Git.csproj +++ b/src/Cake.Git/Cake.Git.csproj @@ -17,9 +17,7 @@ {08F0A5C3-0E9C-451D-B003-14FF73699BE1} - - All - + diff --git a/src/Cake.Git/GitAliases.Branch.cs b/src/Cake.Git/GitAliases.Branch.cs index ea3d563..0a11db2 100644 --- a/src/Cake.Git/GitAliases.Branch.cs +++ b/src/Cake.Git/GitAliases.Branch.cs @@ -67,8 +67,7 @@ public static GitBranch GitBranchCurrent(this ICakeContext context, DirectoryPat /// /// [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) { @@ -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); }); + } } } diff --git a/src/Cake.Git/GitAliases.Log.cs b/src/Cake.Git/GitAliases.Log.cs index 9e4c756..6a9f5fc 100644 --- a/src/Cake.Git/GitAliases.Log.cs +++ b/src/Cake.Git/GitAliases.Log.cs @@ -133,7 +133,7 @@ string sinceCommitId return repository.Commits .QueryBy(new CommitFilter { - IncludeReachableFrom = sinceCommitId, + IncludeReachableFrom = repository.Head, ExcludeReachableFrom = repository.Lookup(sinceCommitId).Parents }) .Select(commit => new GitCommit(commit)) diff --git a/src/Cake.Git/GitAliases.Tag.cs b/src/Cake.Git/GitAliases.Tag.cs index 766a8a4..6e1335e 100644 --- a/src/Cake.Git/GitAliases.Tag.cs +++ b/src/Cake.Git/GitAliases.Tag.cs @@ -25,7 +25,7 @@ public static partial class GitAliases /// The tag name. /// [CakeMethodAlias] - [CakeAliasCategory("Tag")] + [CakeAliasCategory("Tags")] public static void GitTag( this ICakeContext context, DirectoryPath repositoryDirectoryPath, diff --git a/src/Cake.Git/GitAliases.Tags.cs b/src/Cake.Git/GitAliases.Tags.cs index 0f87b18..8d9be67 100644 --- a/src/Cake.Git/GitAliases.Tags.cs +++ b/src/Cake.Git/GitAliases.Tags.cs @@ -18,7 +18,7 @@ partial class GitAliases /// /// [CakeMethodAlias] - [CakeAliasCategory("AllTags")] + [CakeAliasCategory("Tags")] public static List GitTags( this ICakeContext context, DirectoryPath repositoryDirectoryPath) diff --git a/src/SolutionInfo.cs b/src/SolutionInfo.cs index 675253a..d3d9695 100644 --- a/src/SolutionInfo.cs +++ b/src/SolutionInfo.cs @@ -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)] diff --git a/test.cake b/test.cake index 3f2aa74..9b9754e 100644 --- a/test.cake +++ b/test.cake @@ -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(() => @@ -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) { @@ -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") diff --git a/tools/packages.config b/tools/packages.config index 5247765..cf77e99 100644 --- a/tools/packages.config +++ b/tools/packages.config @@ -1,5 +1,5 @@ - - + +