-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added first commit to the history view
- Loading branch information
1 parent
dda21c6
commit 1055aed
Showing
4 changed files
with
403 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
Commit = require("../objects/commit").Commit | ||
ObjectsDao = require("./objects.dao").ObjectsDao | ||
|
||
class CommitsDao extends ObjectsDao | ||
|
||
constructor: (log)-> super log | ||
|
||
populateEntity: (meta, attributes) => | ||
if attributes? | ||
tree = @getLink meta.links, "tree" | ||
parent = @getLink meta.links, "parent" | ||
author = @getLink meta.links, "author" | ||
committer = @getLink meta.links, "committer" | ||
repository = @getLink meta.links, "repository" | ||
authorEmail = attributes.authorEmail | ||
committerEmail = attributes.committerEmail | ||
authoredDate = attributes.authoredDate | ||
commitedDate = attributes.commitedDate | ||
new Commit(tree, parent, author, authorEmail, authoredDate, committer, committerEmail, commitedDate, attributes.message, repository, meta.key) | ||
|
||
getParents: (commitId, callback) => | ||
@links commitId, [["objects", "parent", 1],["objects", "parent", 1],["objects", "parent", 1],["objects", "parent", 1],["objects", "parent", 1],["objects", "parent", 1],["objects", "parent", 1],["objects", "parent", 1],["objects", "parent", 1],["objects", "parent", 1]], (err, docs) => | ||
if err | ||
callback err | ||
else | ||
commits = [] | ||
for doc in docs | ||
data = doc.data | ||
commit = @populateEntity(doc.meta, data) | ||
commits.push commit if commit? | ||
@get commitId, (err, commit) -> | ||
if err | ||
callback undefined, commits | ||
else | ||
commits.unshift commit | ||
callback undefined, commits | ||
|
||
exports.newInstance = (log) -> new CommitsDao(log) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.