incubator-allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brond...@apache.org
Subject [3/6] git commit: [#5685] Added some error checking for some corner cases
Date Tue, 19 Feb 2013 19:26:45 GMT
[#5685] Added some error checking for some corner cases

Signed-off-by: Cory Johns <johnsca@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/3a9359a0
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/3a9359a0
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/3a9359a0

Branch: refs/heads/master
Commit: 3a9359a01f7c7c8f6a15fcdf3b9deca6f447a6ab
Parents: 3f3834b
Author: Cory Johns <johnsca@geek.net>
Authored: Tue Feb 12 03:37:07 2013 +0000
Committer: Dave Brondsema <dbrondsema@geek.net>
Committed: Tue Feb 19 19:26:30 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/3a9359a0/Allura/allura/model/repo.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/repo.py b/Allura/allura/model/repo.py
index 568e7f8..6d0f0a4 100644
--- a/Allura/allura/model/repo.py
+++ b/Allura/allura/model/repo.py
@@ -493,8 +493,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:
@@ -509,7 +512,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/3a9359a0/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/3a9359a0/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):


Mime
View raw message