Return-Path: X-Original-To: apmail-incubator-allura-commits-archive@minotaur.apache.org Delivered-To: apmail-incubator-allura-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 60487E4A8 for ; Thu, 7 Mar 2013 17:47:39 +0000 (UTC) Received: (qmail 80772 invoked by uid 500); 7 Mar 2013 17:47:39 -0000 Delivered-To: apmail-incubator-allura-commits-archive@incubator.apache.org Received: (qmail 80740 invoked by uid 500); 7 Mar 2013 17:47:39 -0000 Mailing-List: contact allura-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: allura-dev@incubator.apache.org Delivered-To: mailing list allura-commits@incubator.apache.org Received: (qmail 80720 invoked by uid 99); 7 Mar 2013 17:47:39 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 07 Mar 2013 17:47:39 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id C30AB831676; Thu, 7 Mar 2013 17:47:38 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: brondsem@apache.org To: allura-commits@incubator.apache.org X-Mailer: ASF-Git Admin Mailer Subject: [3/3] git commit: [#5854] Fixed SVN.last_commit_ids when given a single path Message-Id: <20130307174738.C30AB831676@tyr.zones.apache.org> Date: Thu, 7 Mar 2013 17:47:38 +0000 (UTC) Updated Branches: refs/heads/master 86b650abe -> 4e1b45015 [#5854] Fixed SVN.last_commit_ids when given a single path Signed-off-by: Cory Johns 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 Authored: Thu Feb 28 22:27:22 2013 +0000 Committer: Dave Brondsema 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')