[Autoroll] Pretty print Revisions
Right now it looks like this:
github_deps_repo_manager.go:163 lastRollRev is: fe18de506097d9cfa5f2a2a057e1dd134a96c116
github_deps_repo_manager.go:164 nextRollRev is: 2866a5b7471c0677cdfe3318e18433a709f384f7
github_deps_repo_manager.go:165 notRolledRevs: [0xc0006ff560 0xc0006ff620 0xc0006ff8c0]
Change-Id: Ie8c2e70b06abb2fbd138c67dd49a7e391ffbd0cd
Reviewed-on: https://skia-review.googlesource.com/c/buildbot/+/219527
Commit-Queue: Ravi Mistry <rmistry@google.com>
Reviewed-by: Eric Boren <borenet@google.com>
diff --git a/autoroll/go/revision/revision.go b/autoroll/go/revision/revision.go
index 13a7bf9..e66e173 100644
--- a/autoroll/go/revision/revision.go
+++ b/autoroll/go/revision/revision.go
@@ -39,6 +39,14 @@
}
}
+// Implement the Stringer interface for prettier printing.
+func (r *Revision) String() string {
+ if r.Display != "" {
+ return r.Display
+ }
+ return r.Id
+}
+
// FromLongCommit converts a vcsinfo.LongCommit to a Revision. If revLinkTmpl is
// not provided, the Revision will have no URL.
func FromLongCommit(revLinkTmpl string, c *vcsinfo.LongCommit) *Revision {