Skip to content

Commit

Permalink
added first commit to the history view
Browse files Browse the repository at this point in the history
  • Loading branch information
podviaznikov committed Nov 10, 2011
1 parent dda21c6 commit 1055aed
Show file tree
Hide file tree
Showing 4 changed files with 403 additions and 5 deletions.
13 changes: 9 additions & 4 deletions lib/dao/commits.dao.coffee
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Commit = require("../objects/commit").Commit
Commit = require("../objects/commit").Commit
ObjectsDao = require("./objects.dao").ObjectsDao

class CommitsDao extends ObjectsDao
Expand All @@ -20,15 +20,20 @@ class CommitsDao extends ObjectsDao

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)
if err
callback err
else
commits = []
for doc in docs
data = doc.data
commit = @populateEntity(doc.meta, data)
commits.push commit if commit?
callback undefined, commits
# fetching initial commit by specified i. NOTE (anton) refactor it. We fetching this list in 2 requests here
@get commitId, (err, commit) ->
if err
callback undefined, commits
else
commits.unshift commit
callback undefined, commits

exports.newInstance = (log) -> new CommitsDao(log)

38 changes: 38 additions & 0 deletions lib/dao/commits.dao.coffee~
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)
1 change: 0 additions & 1 deletion lib/massive.git.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,6 @@ MassiveGit = exports.MassiveGit = class MassiveGit
else
callback undefined, repo


deleteRepo: (repoId, author, callback) =>
@reposDao.remove repoId, (err, ok) =>
if(err)
Expand Down
Loading

0 comments on commit 1055aed

Please sign in to comment.