diff --git a/.gitignore b/.gitignore index bdc3535..e0f8e79 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,8 @@ # Build Folders (you can keep bin if you'd like, to store dlls and pdbs) [Bb]in/ [Oo]bj/ +.vs +.vscode # mstest test results TestResults diff --git a/Logic/CommitEdge.cs b/Logic/CommitEdge.cs index 4044de8..7ec51f9 100644 --- a/Logic/CommitEdge.cs +++ b/Logic/CommitEdge.cs @@ -1,4 +1,4 @@ -using QuickGraph; +using QuikGraph; namespace GitViz.Logic { diff --git a/Logic/CommitGraph.cs b/Logic/CommitGraph.cs index afa6b4d..ad63b12 100644 --- a/Logic/CommitGraph.cs +++ b/Logic/CommitGraph.cs @@ -1,4 +1,4 @@ -using QuickGraph; +using QuikGraph; namespace GitViz.Logic { diff --git a/Logic/GitCommandExecutor.cs b/Logic/GitCommandExecutor.cs index 17197c6..579d337 100644 --- a/Logic/GitCommandExecutor.cs +++ b/Logic/GitCommandExecutor.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Diagnostics; using System.IO; @@ -15,13 +15,20 @@ public GitCommandExecutor(string repositoryPath) public string Execute(string command) { - var process = CreateProcess(command); - process.WaitForExit(10000); + string errorText; + try + { + var process = CreateProcess(command); + process.WaitForExit(10000); - if (process.ExitCode == 0) - return process.StandardOutput.ReadToEnd(); + if (process.ExitCode == 0) + return process.StandardOutput.ReadToEnd(); + errorText = process.StandardError.ReadToEnd(); + } catch (System.ComponentModel.Win32Exception) + { + errorText = "Could not locate git. Check it is installed and in your PATH settings"; + } - var errorText = process.StandardError.ReadToEnd(); throw new ApplicationException(errorText); } @@ -43,7 +50,8 @@ Process CreateProcess(string command) RedirectStandardOutput = true, RedirectStandardError = true }; - var process = Process.Start(startInfo); + Process process; + process = Process.Start(startInfo); return process; } } diff --git a/Logic/InternalVisibleForTests.cs b/Logic/InternalVisibleForTests.cs new file mode 100644 index 0000000..20fb199 --- /dev/null +++ b/Logic/InternalVisibleForTests.cs @@ -0,0 +1,2 @@ +using System.Runtime.CompilerServices; +[assembly: InternalsVisibleTo("Tests")] diff --git a/Logic/Logic.csproj b/Logic/Logic.csproj index 25284cf..b710639 100644 --- a/Logic/Logic.csproj +++ b/Logic/Logic.csproj @@ -1,100 +1,11 @@ - - - + + - Debug - AnyCPU - {BF9333A3-490D-4C93-9F41-11016C9B324C} - Library - Properties - GitViz.Logic - GitViz.Logic - v4.5 - 512 + netstandard2.0 - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - ..\packages\GraphSharp.1.1.0.0\lib\net40\GraphSharp.dll - - - ..\packages\GraphSharp.1.1.0.0\lib\net40\GraphSharp.Controls.dll - - - ..\packages\QuickGraph.3.6.61119.7\lib\net4\QuickGraph.dll - - - ..\packages\QuickGraph.3.6.61119.7\lib\net4\QuickGraph.Data.dll - - - ..\packages\QuickGraph.3.6.61119.7\lib\net4\QuickGraph.Graphviz.dll - - - ..\packages\QuickGraph.3.6.61119.7\lib\net4\QuickGraph.Serialization.dll - - - - - ..\packages\Rx-Core.2.1.30214.0\lib\Net45\System.Reactive.Core.dll - - - ..\packages\Rx-Interfaces.2.1.30214.0\lib\Net45\System.Reactive.Interfaces.dll - - - ..\packages\Rx-Linq.2.1.30214.0\lib\Net45\System.Reactive.Linq.dll - - - ..\packages\Rx-PlatformServices.2.1.30214.0\lib\Net45\System.Reactive.PlatformServices.dll - - - - - - - - ..\packages\WPFExtensions.1.0.0\lib\WPFExtensions.dll - - - - - - - - - - - - - - - - - + - + + - - \ No newline at end of file diff --git a/Logic/Properties/AssemblyInfo.cs b/Logic/Properties/AssemblyInfo.cs deleted file mode 100644 index 29a162d..0000000 --- a/Logic/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,38 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("Logic")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("Logic")] -[assembly: AssemblyCopyright("Copyright © 2013")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("1e3cd963-bb28-4e8b-988f-8f5be0725f77")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] - -[assembly: InternalsVisibleTo("GitViz.Tests")] diff --git a/Logic/RepositoryWatcher.cs b/Logic/RepositoryWatcher.cs index a29d3a5..4865e2a 100644 --- a/Logic/RepositoryWatcher.cs +++ b/Logic/RepositoryWatcher.cs @@ -1,9 +1,6 @@ using System; -using System.Collections.Generic; -using System.Diagnostics; using System.IO; using System.Reactive.Linq; -using System.Threading; namespace GitViz.Logic { diff --git a/Logic/ViewModel.cs b/Logic/ViewModel.cs index 165473c..98dbd70 100644 --- a/Logic/ViewModel.cs +++ b/Logic/ViewModel.cs @@ -21,7 +21,7 @@ public string WindowTitle { get { - return "Readify GitViz (Alpha)" + return "Readify GitViz (Beta)" + (string.IsNullOrWhiteSpace(_repositoryPath) ? string.Empty : " - " + Path.GetFileName(_repositoryPath)); diff --git a/Logic/packages.config b/Logic/packages.config deleted file mode 100644 index 2082388..0000000 --- a/Logic/packages.config +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/README.md b/README.md index 2e3ac56..7041026 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,11 @@ GitViz ====== -> Psst, hey... are you looking for a .NET Core 3 version? Check out the `netcore` branch. Contributions and PRs on that branch are very welcome! +> GitViz is now available as a .NET Core 3.1 application ### Type commands. See their effect in real time. Perfect rendering for presentations. -Among the many things we do at [Readify](http://readify.net) to help people build better software, we teach people about Git. +Among all things we do at Readify (now [Telstra Purple](https://purple.telstra.com)) to help people build better software, we teach people about Git. For newbies, the concept of commit graphs, references, branches and merges can be a bit hard to visualize. @@ -23,7 +23,7 @@ Pre-built binaries are available at https://github.com/Readify/GitViz/releases ### Release Quality -__Alpha.__ This entire project so far consists of one Readify guy sitting down the back of a training course and tapping away for a few hours, no more. +__Beta.__ This was built by one guy sitting at the back of a training course and tapping away for a few hours, no more. Since then it's been well used and hasn't seen many issues, so we're calling it 'beta'. Will that ever change? ¯\_(ツ)_/¯ ### What is 'presentation quality'? @@ -35,7 +35,7 @@ This is not a day-to-day visualizing tool for big, active repositories. It's opt ### How it works -Shells out to `git.exe`, and then renders it with the excellent [GraphSharp](http://graphsharp.codeplex.com). +Shells out to `git.exe`, and then renders it with the excellent [GraphShape](https://github.com/KeRNeLith/GraphShape). ### FAQ #### How can I remove dangling commits? diff --git a/Tests/LogParserTests/ParseCommit.cs b/Tests/LogParserTests/ParseCommit.cs index 191b1ab..ae4dd2d 100644 --- a/Tests/LogParserTests/ParseCommit.cs +++ b/Tests/LogParserTests/ParseCommit.cs @@ -1,4 +1,4 @@ -using GitViz.Logic; +using GitViz.Logic; using NUnit.Framework; namespace GitViz.Tests.LogParserTests @@ -9,27 +9,27 @@ public class ParseCommit [TestCase( "1383697102 4be5ef1", Description = "Initial commit", - Result = "{Hash:4be5ef1,CommitDate:1383697102,ShortHash:4be5ef1}")] + ExpectedResult = "{Hash:4be5ef1,CommitDate:1383697102,ShortHash:4be5ef1}")] [TestCase( "1383697102 4be5ef1 (HEAD, master)", Description = "Initial commit with head and master", - Result = "{Hash:4be5ef1,Refs:[HEAD,master],CommitDate:1383697102,ShortHash:4be5ef1}")] + ExpectedResult = "{Hash:4be5ef1,Refs:[HEAD,master],CommitDate:1383697102,ShortHash:4be5ef1}")] [TestCase( "1383697102 4be5ef1 (HEAD, origin/master, origin/HEAD, master)", Description = "Initial commit with head and remote master", - Result = "{Hash:4be5ef1,Refs:[HEAD,origin/master,origin/HEAD,master],CommitDate:1383697102,ShortHash:4be5ef1}")] + ExpectedResult = "{Hash:4be5ef1,Refs:[HEAD,origin/master,origin/HEAD,master],CommitDate:1383697102,ShortHash:4be5ef1}")] [TestCase( "1383697102 4e4224c 4be5ef1", Description = "Commit with one parent", - Result = "{Hash:4e4224c,ParentHashes:[4be5ef1],CommitDate:1383697102,ShortHash:4e4224c}")] + ExpectedResult = "{Hash:4e4224c,ParentHashes:[4be5ef1],CommitDate:1383697102,ShortHash:4e4224c}")] [TestCase( "1383697102 d472fda 3c27924 5411a9f", Description = "Commit with two parents", - Result = "{Hash:d472fda,ParentHashes:[3c27924,5411a9f],CommitDate:1383697102,ShortHash:d472fda}")] + ExpectedResult = "{Hash:d472fda,ParentHashes:[3c27924,5411a9f],CommitDate:1383697102,ShortHash:d472fda}")] [TestCase( "1383697102 d472fda 3c27924 5411a9f 6789abc", Description = "Commit with three parents", - Result = "{Hash:d472fda,ParentHashes:[3c27924,5411a9f,6789abc],CommitDate:1383697102,ShortHash:d472fda}")] + ExpectedResult = "{Hash:d472fda,ParentHashes:[3c27924,5411a9f,6789abc],CommitDate:1383697102,ShortHash:d472fda}")] public string Test(string logLine) { var commit = LogParser.ParseCommit(logLine); diff --git a/Tests/LogRetrieverTests.cs b/Tests/LogRetrieverTests.cs index e7a09f3..cd235fe 100644 --- a/Tests/LogRetrieverTests.cs +++ b/Tests/LogRetrieverTests.cs @@ -1,4 +1,4 @@ -using System.Linq; +using System.Linq; using GitViz.Logic; using NUnit.Framework; @@ -38,7 +38,8 @@ public void ShouldReturnSingleRecentCommitWithHashButNoParents() Assert.AreEqual(1, log.Length); var commit = log.Single(); - Assert.IsNotNullOrEmpty(commit.Hash); + Assert.IsNotNull(commit.Hash); + Assert.IsNotEmpty(commit.Hash); Assert.AreEqual(40, commit.Hash.Length); Assert.IsNull(commit.ParentHashes); } @@ -57,7 +58,7 @@ public void ShouldReturnSingleRecentCommitWithLocalRefs() var log = new LogRetriever(executor).GetRecentCommits().ToArray(); var commit = log.Single(); - CollectionAssert.AreEqual(new[] { "HEAD", "master" }, commit.Refs); + CollectionAssert.AreEqual(new[] { "HEAD -> master" }, commit.Refs); } } @@ -77,12 +78,14 @@ public void ShouldReturnTwoRecentCommits() Assert.AreEqual(2, log.Length); var commit = log.ElementAt(0); - Assert.IsNotNullOrEmpty(commit.Hash); + Assert.IsNotNull(commit.Hash); + Assert.IsNotEmpty(commit.Hash); Assert.AreEqual(40, commit.Hash.Length); CollectionAssert.AreEqual(new[] { log.ElementAt(1).Hash }, commit.ParentHashes); commit = log.ElementAt(1); - Assert.IsNotNullOrEmpty(commit.Hash); + Assert.IsNotNull(commit.Hash); + Assert.IsNotEmpty(commit.Hash); Assert.AreEqual(40, commit.Hash.Length); Assert.IsNull(commit.ParentHashes); } diff --git a/Tests/Properties/AssemblyInfo.cs b/Tests/Properties/AssemblyInfo.cs deleted file mode 100644 index 452bf52..0000000 --- a/Tests/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("Tests")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("Tests")] -[assembly: AssemblyCopyright("Copyright © 2013")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("74e9f26d-6c11-462d-8160-ab98e899361e")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Tests/Tests.csproj b/Tests/Tests.csproj index 6da335c..01a3feb 100644 --- a/Tests/Tests.csproj +++ b/Tests/Tests.csproj @@ -1,80 +1,24 @@ - - - + + - Debug - AnyCPU - {E9951372-AC02-47B4-BDEF-9518A5442BD1} - Library - Properties - GitViz.Tests - GitViz.Tests - v4.5 - 512 + netcoreapp3.1 + false - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - ..\packages\Newtonsoft.Json.5.0.8\lib\net45\Newtonsoft.Json.dll - - - ..\packages\NUnit.2.6.3\lib\nunit.framework.dll - - - - - - - - - - - - - - - - - - - - - - + - - {bf9333a3-490d-4c93-9f41-11016c9b324c} - Logic - + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + - + + - + - - \ No newline at end of file diff --git a/Tests/packages.config b/Tests/packages.config deleted file mode 100644 index 835e599..0000000 --- a/Tests/packages.config +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/UI/App.config b/UI/App.config deleted file mode 100644 index 8e15646..0000000 --- a/UI/App.config +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/UI/App.xaml b/UI/App.xaml index 35ce31d..b363ea9 100644 --- a/UI/App.xaml +++ b/UI/App.xaml @@ -1,4 +1,4 @@ - diff --git a/UI/App.xaml.cs b/UI/App.xaml.cs index 2eba8db..a58b9a8 100644 --- a/UI/App.xaml.cs +++ b/UI/App.xaml.cs @@ -1,9 +1,3 @@ -using System; -using System.Collections.Generic; -using System.Configuration; -using System.Data; -using System.Linq; -using System.Threading.Tasks; using System.Windows; namespace UI diff --git a/UI/CommitGraphLayout.cs b/UI/CommitGraphLayout.cs index 62ab56d..dba96b0 100644 --- a/UI/CommitGraphLayout.cs +++ b/UI/CommitGraphLayout.cs @@ -1,5 +1,5 @@ -using GitViz.Logic; -using GraphSharp.Controls; +using GitViz.Logic; +using GraphShape.Controls; namespace UI { diff --git a/UI/MainWindow.xaml b/UI/MainWindow.xaml index 93cd468..617a161 100644 --- a/UI/MainWindow.xaml +++ b/UI/MainWindow.xaml @@ -1,9 +1,9 @@ -