You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by jo...@apache.org on 2013/02/13 16:15:43 UTC
git commit: [#5685] Removed LCD implementation that calls git,
as perceived gains were illusory
Updated Branches:
refs/heads/cj/5685 110e0bbfb -> f65e2e66c (forced update)
[#5685] Removed LCD implementation that calls git, as perceived gains were illusory
Also improved some error handling around some corner cases that
shouldn't really ever come up.
Signed-off-by: Cory Johns <jo...@geek.net>
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/f65e2e66
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/f65e2e66
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/f65e2e66
Branch: refs/heads/cj/5685
Commit: f65e2e66cee2a3079b3b5a5af663160f159eca84
Parents: 231ee23
Author: Cory Johns <jo...@geek.net>
Authored: Tue Feb 12 21:19:04 2013 +0000
Committer: Cory Johns <jo...@geek.net>
Committed: Wed Feb 13 15:15:06 2013 +0000
----------------------------------------------------------------------
Allura/allura/model/repo.py | 11 ++++++++---
Allura/allura/model/repository.py | 4 +++-
ForgeGit/forgegit/model/git_repo.py | 14 --------------
ForgeSVN/forgesvn/model/svn.py | 10 +++++-----
4 files changed, 16 insertions(+), 23 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/f65e2e66/Allura/allura/model/repo.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/repo.py b/Allura/allura/model/repo.py
index 569cbb3..f17415d 100644
--- a/Allura/allura/model/repo.py
+++ b/Allura/allura/model/repo.py
@@ -489,8 +489,11 @@ class Tree(RepoObject):
last_commit = LastCommit.get(self, create=True)
# ensure that the LCD is saved, even if
# there is an error later in the request
- session(last_commit).flush(last_commit)
- return self._lcd_map(LastCommit.get(self))
+ if last_commit:
+ session(last_commit).flush(last_commit)
+ return self._lcd_map(last_commit)
+ else:
+ return []
def _lcd_map(self, lcd):
if lcd is None:
@@ -505,7 +508,9 @@ class Tree(RepoObject):
results = []
for type, names in (('DIR', tree_names), ('BLOB', blob_names)):
for name in names:
- commit_info = commit_infos[lcd.by_name[name]]
+ commit_info = commit_infos.get(lcd.by_name.get(name))
+ if not commit_info:
+ continue
results.append(dict(
kind=type,
name=name,
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/f65e2e66/Allura/allura/model/repository.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/repository.py b/Allura/allura/model/repository.py
index 05dc771..008d81d 100644
--- a/Allura/allura/model/repository.py
+++ b/Allura/allura/model/repository.py
@@ -134,8 +134,10 @@ class RepositoryImplementation(object):
paths = paths - changed
else:
result.update({path: commit._id for path in paths})
+ paths = set()
+ # end hacky work-around
- commit = commit.get_parent()
+ commit = parent
return result
@classmethod
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/f65e2e66/ForgeGit/forgegit/model/git_repo.py
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/model/git_repo.py b/ForgeGit/forgegit/model/git_repo.py
index 0bcd4c2..7154a6d 100644
--- a/ForgeGit/forgegit/model/git_repo.py
+++ b/ForgeGit/forgegit/model/git_repo.py
@@ -252,20 +252,6 @@ class GitImplementation(M.RepositoryImplementation):
commit = self._git.commit(rev)
return commit.count(path)
- def last_commit_ids(self, commit, paths):
- cache = getattr(c, 'model_cache', '') or M.repo.ModelCache()
- tree_path = os.path.commonprefix(paths).strip('/')
- paths = set(paths)
- result = {}
- for commit_id in self.commits(path=tree_path, rev=commit._id):
- commit = cache.get(M.repo.Commit, dict(_id=commit_id))
- changed = paths & set(commit.changed_paths)
- result.update({path: commit_id for path in changed})
- paths = paths - changed
- if not paths:
- break
- return result
-
def log(self, object_id, skip, count):
obj = self._git.commit(object_id)
candidates = [ obj ]
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/f65e2e66/ForgeSVN/forgesvn/model/svn.py
----------------------------------------------------------------------
diff --git a/ForgeSVN/forgesvn/model/svn.py b/ForgeSVN/forgesvn/model/svn.py
index 33bac43..8d9ee77 100644
--- a/ForgeSVN/forgesvn/model/svn.py
+++ b/ForgeSVN/forgesvn/model/svn.py
@@ -550,9 +550,9 @@ class SVNImplementation(M.RepositoryImplementation):
opts['limit'] = skip + limit
try:
revs = self._svn.log(path, **opts)
- except pysvn.ClientError:
- log.info('ClientError processing commits for path %s, rev %s, skip=%s, limit=%s, treating as empty',
- path, rev, skip, limit, exc_info=True)
+ except pysvn.ClientError as e:
+ log.exception('ClientError processing commits for SVN: path %s, rev %s, skip=%s, limit=%s, treating as empty',
+ path, rev, skip, limit)
return []
if skip:
# pysvn has already limited result for us, we just need to skip
@@ -570,8 +570,8 @@ class SVNImplementation(M.RepositoryImplementation):
opts['revision_end'] = pysvn.Revision(pysvn.opt_revision_kind.number, 0)
try:
return len(self._svn.log(path, **opts))
- except pysvn.ClientError:
- log.info('ClientError processing commits for path %s, rev %s, treating as empty', path, rev, exc_info=True)
+ except pysvn.ClientError as e:
+ log.exception('ClientError processing commits for SVN: path %s, rev %s, treating as empty', path, rev)
return 0
def last_commit_ids(self, commit, paths):