From 9fae57114a9d489fcbba9c8df0cc20a364cb6a10 Mon Sep 17 00:00:00 2001 From: Ben Marwick Date: Sat, 9 May 2015 01:37:13 -0700 Subject: [PATCH] added methods for committer, sha, branch, commit message --- R/commit.r | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) diff --git a/R/commit.r b/R/commit.r index 6b79ec073..c33e5f096 100644 --- a/R/commit.r +++ b/R/commit.r @@ -582,3 +582,63 @@ setMethod("summary", invisible(NULL) } ) + + +##' @export sha +setGeneric("sha", + function(object) + standardGeneric("sha")) +##' @rdname commit-methods +##' @export sha +setMethod("sha", + signature(object = "git_commit"), + function (object) + { + as(object@sha, "character") + } +) + + +##' @export committer +setGeneric("committer", + function(object) + standardGeneric("committer")) +##' @rdname commit-methods +##' @export committer +setMethod("committer", + signature(object = "git_commit"), + function (object) + { + as(object@committer@name, "character") + } +) + + +##' @export message +setGeneric("message", + function(object) + standardGeneric("message")) +##' @rdname commit-methods +##' @export message +setMethod("message", + signature(object = "git_commit"), + function (object) + { + as(object@summary, "character") + } +) + + +##' @export branch +setGeneric("branch", + function(object) + standardGeneric("branch")) +##' @rdname commit-methods +##' @export branch +setMethod("branch", + signature(object = "git_commit"), + function (object) + { + as(branches(repo)[[1]]@name, "character") + } +)