incubator-allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brond...@apache.org
Subject [3/3] git commit: [#5854] Fixed SVN.last_commit_ids when given a single path
Date Thu, 07 Mar 2013 17:47:38 GMT
Updated Branches:
  refs/heads/master 86b650abe -> 4e1b45015


[#5854] Fixed SVN.last_commit_ids when given a single path

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/368bea02
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/368bea02
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/368bea02

Branch: refs/heads/master
Commit: 368bea026efa7fd1fb89428465c0ecc4fcbe47bc
Parents: 86b650a
Author: Cory Johns <johnsca@geek.net>
Authored: Thu Feb 28 22:27:22 2013 +0000
Committer: Dave Brondsema <dbrondsema@geek.net>
Committed: Thu Mar 7 17:47:23 2013 +0000

----------------------------------------------------------------------
 ForgeSVN/forgesvn/model/svn.py                     |    7 ++++++-
 .../forgesvn/tests/model/test_svnimplementation.py |    9 ++++++---
 2 files changed, 12 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/368bea02/ForgeSVN/forgesvn/model/svn.py
----------------------------------------------------------------------
diff --git a/ForgeSVN/forgesvn/model/svn.py b/ForgeSVN/forgesvn/model/svn.py
index cdafa9d..ca0e8ac 100644
--- a/ForgeSVN/forgesvn/model/svn.py
+++ b/ForgeSVN/forgesvn/model/svn.py
@@ -587,7 +587,11 @@ class SVNImplementation(M.RepositoryImplementation):
         single common parent path (i.e., you are only asking for
         a subset of the nodes of a single tree, one level deep).
         '''
-        tree_path = '/' + os.path.commonprefix(paths).strip('/')  # always leading slash,
never trailing
+        if len(paths) == 1:
+            tree_path = '/' + os.path.dirname(paths[0].strip('/'))
+        else:
+            tree_path = '/' + os.path.commonprefix(paths).strip('/')  # always leading slash,
never trailing
+        paths = [path.strip('/') for path in paths]
         rev = self._revision(commit._id)
         try:
             infos = self._svn.info2(
@@ -600,6 +604,7 @@ class SVNImplementation(M.RepositoryImplementation):
             return None
         entries = {}
         for path, info in infos[1:]:
+            path = os.path.join(tree_path, path).strip('/')
             if path in paths:
                 entries[path] = self._oid(info.last_changed_rev.number)
         return entries

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/368bea02/ForgeSVN/forgesvn/tests/model/test_svnimplementation.py
----------------------------------------------------------------------
diff --git a/ForgeSVN/forgesvn/tests/model/test_svnimplementation.py b/ForgeSVN/forgesvn/tests/model/test_svnimplementation.py
index 3a5ae5d..a4e1e47 100644
--- a/ForgeSVN/forgesvn/tests/model/test_svnimplementation.py
+++ b/ForgeSVN/forgesvn/tests/model/test_svnimplementation.py
@@ -45,11 +45,14 @@ class TestSVNImplementation(object):
     def _test_last_commit_ids(self, path):
         repo = Mock(fs_path='/tmp/')
         repo.name = 'code'
+        repo._id = '5057636b9c1040636b81e4b1'
         impl = SVNImplementation(repo)
         impl._svn.info2 = Mock()
-        impl._svn.info2.return_value = [('foo', Mock())]
+        impl._svn.info2.return_value = [('trunk', Mock()), ('foo', Mock())]
+        impl._svn.info2.return_value[1][1].last_changed_rev.number = '1'
         commit = Commit()
         commit._id = '5057636b9c1040636b81e4b1:6'
-        tree_id = impl.last_commit_ids(commit, [path])
+        entries = impl.last_commit_ids(commit, [path])
 
-        assert_equal(impl._svn.info2.call_args[0][0], 'file:///tmp/code/trunk/foo')
+        assert_equal(entries, {path.strip('/'): '5057636b9c1040636b81e4b1:1'})
+        assert_equal(impl._svn.info2.call_args[0][0], 'file:///tmp/code/trunk')


Mime
View raw message