Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show methods for Signatures and Commits #19951

Merged
merged 1 commit into from
Jan 11, 2017
Merged

Show methods for Signatures and Commits #19951

merged 1 commit into from
Jan 11, 2017

Conversation

kshyatt
Copy link
Contributor

@kshyatt kshyatt commented Jan 9, 2017

Add show methods for Signature and Commits in LibGit2.
Display the time of the commit using Julia's built-in date handling.

Re: #19839

@kshyatt kshyatt added domain:display and printing Aesthetics and correctness of printed representations of objects. libgit2 The libgit2 library or the LibGit2 stdlib module labels Jan 9, 2017
function Base.show(io::IO, c::GitCommit)
authstr = sprint(show, author(c))
cmtrstr = sprint(show, committer(c))
print(io, "Commit Author: $authstr\nCommitter: $cmtrstr\nMessage:\n$(message(c))")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe print the hash as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

function Base.show(io::IO, c::GitCommit)
authstr = sprint(show, author(c))
cmtrstr = sprint(show, committer(c))
print(io, "Commit Author: $authstr\nCommitter: $cmtrstr\nSHA: $(Oid(c))\nMessage:\n$(message(c))")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oid is now GitHash (#19878)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, it would probably be useful to print the typename, both here and the other PRs.

Add `show` methods for `Signature` and `Commit`s in LibGit2.
Display the time of the commit using Julia's built-in date handling.
@kshyatt
Copy link
Contributor Author

kshyatt commented Jan 10, 2017

Updated!

@simonbyrne simonbyrne merged commit f46bd49 into master Jan 11, 2017
@simonbyrne simonbyrne deleted the ksh/showcommit branch January 11, 2017 12:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
domain:display and printing Aesthetics and correctness of printed representations of objects. libgit2 The libgit2 library or the LibGit2 stdlib module
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants