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/15 23:46:12 UTC

[10/10] git commit: [#5685] Added some error checking for some corner cases

Updated Branches:
  refs/heads/cj/5685 826838b4a -> ebfae6f28 (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/ebfae6f2
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/ebfae6f2
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/ebfae6f2

Branch: refs/heads/cj/5685
Commit: ebfae6f284a052ac96cb322511f1e7c52dbe5788
Parents: e826b49
Author: Cory Johns <jo...@geek.net>
Authored: Tue Feb 12 03:37:07 2013 +0000
Committer: Cory Johns <jo...@geek.net>
Committed: Fri Feb 15 22:45:25 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/ebfae6f2/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/ebfae6f2/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/ebfae6f2/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):