aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Spiers <git@adamspiers.org>2015-01-11 14:05:56 +0000
committerAdam Spiers <git@adamspiers.org>2015-01-11 15:17:59 +0000
commit8b3d182fabee62ae52060b74c03ffe97142929dd (patch)
treebc6c0fc263fb35905f9679aac6ed63e35fb64de4
parentfdd5a23a021dc1eb1eb856826db7e3c83a215c70 (diff)
downloadgit-deps-8b3d182fabee62ae52060b74c03ffe97142929dd.tar.gz
via JSON response, track which commits have been explored (#17)
Fixes #17.
-rwxr-xr-xgit-deps9
-rw-r--r--html/js/git-deps-data.coffee6
2 files changed, 14 insertions, 1 deletions
diff --git a/git-deps b/git-deps
index 4a2ab57..97486c6 100755
--- a/git-deps
+++ b/git-deps
@@ -145,6 +145,10 @@ class JSONDependencyListener(DependencyListener):
'dependencies': [],
}
+ def get_commit(self, sha1):
+ i = self._commits[sha1]
+ return self._json['commits'][i]
+
def add_commit(self, commit):
"""Adds the commit to the commits array if it doesn't already exist,
and returns the commit's index in the array.
@@ -155,6 +159,7 @@ class JSONDependencyListener(DependencyListener):
return self._commits[sha1]
title, separator, body = commit.message.partition("\n")
commit = {
+ 'explored': False,
'name': abbrev,
'sha1': sha1,
'describe': GitUtils.describe(sha1),
@@ -194,6 +199,10 @@ class JSONDependencyListener(DependencyListener):
self._json['dependencies'].append(new_dependency)
+ def dependent_done(self, dependent, dependencies):
+ commit = self.get_commit(dependent.hex)
+ commit['explored'] = True
+
def json(self):
return self._json
diff --git a/html/js/git-deps-data.coffee b/html/js/git-deps-data.coffee
index 0219a75..0b47ce1 100644
--- a/html/js/git-deps-data.coffee
+++ b/html/js/git-deps-data.coffee
@@ -20,7 +20,11 @@ deps = {}
# Returns 1 iff a node was added, otherwise 0.
add_node = (commit) ->
- return 0 if commit.sha1 of node_index
+ if commit.sha1 of node_index
+ n = node commit.sha1
+ n.explored ||= commit.explored
+ return 0
+
nodes.push commit
node_index[commit.sha1] = nodes.length - 1
return 1