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/18 21:09:15 UTC
[8/8] git commit: [#5685] Added some error checking for some corner
cases
Updated Branches:
refs/heads/cj/5685 ebfae6f28 -> b06192d0f (forced update)
[#5685] Added some error checking for some corner cases
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/b06192d0
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/b06192d0
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/b06192d0
Branch: refs/heads/cj/5685
Commit: b06192d0fef6439081eccc175cd7b7599e9d4aab
Parents: 726c138
Author: Cory Johns <jo...@geek.net>
Authored: Tue Feb 12 03:37:07 2013 +0000
Committer: Cory Johns <jo...@geek.net>
Committed: Mon Feb 18 20:02:52 2013 +0000
----------------------------------------------------------------------
Allura/allura/model/repo.py | 11 ++++++++---
Allura/allura/model/repository.py | 4 +++-
ForgeSVN/forgesvn/model/svn.py | 10 +++++-----
3 files changed, 16 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/b06192d0/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/b06192d0/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/b06192d0/ForgeSVN/forgesvn/model/svn.py
----------------------------------------------------------------------
diff --git a/ForgeSVN/forgesvn/model/svn.py b/ForgeSVN/forgesvn/model/svn.py
index 1d6a815..cdafa9d 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):