From 10959b2e54f2a977416ffcb91fd67a7b537365c0 Mon Sep 17 00:00:00 2001 From: Keith Dahlby Date: Thu, 7 Feb 2013 21:09:06 -0600 Subject: [PATCH 1/2] posh-git-ify TreeChanges.DebuggerDisplay --- LibGit2Sharp/TreeChanges.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LibGit2Sharp/TreeChanges.cs b/LibGit2Sharp/TreeChanges.cs index 5184362d5..a162b36a5 100644 --- a/LibGit2Sharp/TreeChanges.cs +++ b/LibGit2Sharp/TreeChanges.cs @@ -215,7 +215,7 @@ private string DebuggerDisplay get { return string.Format(CultureInfo.InvariantCulture, - "Add: {0}, Del: {1}, Mod: {2}, Typ: {3}", + "+{0} ~{2} -{1} \u00B1{3}", Added.Count(), Deleted.Count(), Modified.Count(), TypeChanged.Count()); } From 4cbf8fab58e55bc5b78385605ecf9d5171b7eac6 Mon Sep 17 00:00:00 2001 From: Keith Dahlby Date: Thu, 7 Feb 2013 21:10:46 -0600 Subject: [PATCH 2/2] Add RepositoryStatus & StatusEntry DebuggerDisplay --- LibGit2Sharp/RepositoryStatus.cs | 15 +++++++++++++++ LibGit2Sharp/StatusEntry.cs | 7 +++++++ 2 files changed, 22 insertions(+) diff --git a/LibGit2Sharp/RepositoryStatus.cs b/LibGit2Sharp/RepositoryStatus.cs index 63172e8c4..2a8839fbb 100644 --- a/LibGit2Sharp/RepositoryStatus.cs +++ b/LibGit2Sharp/RepositoryStatus.cs @@ -2,6 +2,7 @@ using System.Collections; using System.Collections.Generic; using System.Diagnostics; +using System.Globalization; using System.Linq; using LibGit2Sharp.Core; using LibGit2Sharp.Core.Compat; @@ -12,6 +13,7 @@ namespace LibGit2Sharp /// Holds the result of the determination of the state of the working directory. /// Only files that differ from the current index and/or commit will be considered. /// + [DebuggerDisplay("{DebuggerDisplay,nq}")] public class RepositoryStatus : IEnumerable { private readonly ICollection statusEntries; @@ -173,5 +175,18 @@ public virtual bool IsDirty { get { return isDirty; } } + + private string DebuggerDisplay + { + get + { + return string.Format( + CultureInfo.InvariantCulture, + "+{0} ~{1} -{2} | +{3} ~{4} -{5} | i{6}", + Added.Count(), Staged.Count(), Removed.Count(), + Untracked.Count(), Modified.Count(), Missing.Count(), + Ignored.Count()); + } + } } } diff --git a/LibGit2Sharp/StatusEntry.cs b/LibGit2Sharp/StatusEntry.cs index 4eb8850fc..9fad0fb87 100644 --- a/LibGit2Sharp/StatusEntry.cs +++ b/LibGit2Sharp/StatusEntry.cs @@ -1,4 +1,5 @@ using System; +using System.Diagnostics; using LibGit2Sharp.Core; namespace LibGit2Sharp @@ -6,6 +7,7 @@ namespace LibGit2Sharp /// /// Holds the calculated status of a particular file at a particular instant. /// + [DebuggerDisplay("{DebuggerDisplay,nq}")] public class StatusEntry : IEquatable { private readonly string filePath; @@ -92,5 +94,10 @@ public override int GetHashCode() { return !Equals(left, right); } + + private string DebuggerDisplay + { + get { return string.Format("{0}: {1}", State, FilePath); } + } } }