Browse Source

Fix for repo.git.log().

tags/v1.0^2
Ben Kurtovic 10 years ago
parent
commit
e4ddd3ec5f
1 changed files with 15 additions and 14 deletions
  1. +15
    -14
      bitshift/crawler/indexer.py

+ 15
- 14
bitshift/crawler/indexer.py View File

@@ -219,22 +219,23 @@ class GitIndexer(threading.Thread):
return {}

files = {}
self._logger.debug("Building file metadata")
for item in tree.traverse():
if item.type == "blob" and self._is_ascii(item.data_stream):
log = repo.git.log("--follow", '--format=%an %ct', item.path)
lines = log.splitlines()
authors = {line.rsplit(" ", 1)[0] for line in lines}
last_mod = int(lines[0].rsplit(" ", 1)[1])
created = int(lines[-1].rsplit(" ", 1)[1])

files[item.path] = {
"blob": item,
"authors" : authors,
"time_last_modified": datetime.fromtimestamp(last_mod),
"time_created": datetime.fromtimestamp(created)
}
if item.type != "blob" or not self._is_ascii(item.data_stream):
continue
log = repo.git.log("--follow", '--format=%an %ct', "--", item.path)
lines = log.splitlines()
authors = {line.rsplit(" ", 1)[0] for line in lines}
last_mod = int(lines[0].rsplit(" ", 1)[1])
created = int(lines[-1].rsplit(" ", 1)[1])

files[item.path] = {
"blob": item,
"authors" : authors,
"time_last_modified": datetime.fromtimestamp(last_mod),
"time_created": datetime.fromtimestamp(created)
}

self._logger.debug("Building file metadata")
return files

def _is_ascii(self, source):


Loading…
Cancel
Save