incubator-allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tvansteenbu...@apache.org
Subject [5/29] git commit: [#5037] ticket:202 fix commit log controller
Date Tue, 04 Dec 2012 14:26:14 GMT
[#5037] ticket:202 fix commit log controller


Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/234d94e1
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/234d94e1
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/234d94e1

Branch: refs/heads/tv/5382
Commit: 234d94e1d094440fae60199990731d39e116b74e
Parents: 4893d75
Author: Igor Bondarenko <jetmind2@gmail.com>
Authored: Wed Nov 7 13:18:42 2012 +0000
Committer: Cory Johns <johnsca@geek.net>
Committed: Mon Dec 3 23:56:28 2012 +0000

----------------------------------------------------------------------
 Allura/allura/controllers/repository.py            |   10 +++++-----
 .../forgegit/tests/functional/test_controllers.py  |    8 ++++++--
 .../forgehg/tests/functional/test_controllers.py   |    9 ++++++++-
 .../forgesvn/tests/functional/test_controllers.py  |   13 ++++++++++---
 4 files changed, 29 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/234d94e1/Allura/allura/controllers/repository.py
----------------------------------------------------------------------
diff --git a/Allura/allura/controllers/repository.py b/Allura/allura/controllers/repository.py
index 350c8a8..b4a852c 100644
--- a/Allura/allura/controllers/repository.py
+++ b/Allura/allura/controllers/repository.py
@@ -426,13 +426,13 @@ class CommitBrowser(BaseController):
     @with_trailing_slash
     @validate(dict(page=validators.Int(if_empty=0),
                    limit=validators.Int(if_empty=25)))
-    def log(self, limit=25, page=0, path="", **kw):
+    def log(self, limit=25, page=0, path=None, **kw):
         limit, page, start = g.handle_paging(limit, page, default=25)
-        if path[0] == "/":
+        if path and path[0] == "/":
             path = path[1:]
-        params = dict(path=path, rev=self._commit._id, skip=start, limit=limit)
-        commits = c.app.repo.commits(**params)
-        count = c.app.repo.commits(**params)
+        params = dict(path=path, rev=self._commit._id)
+        commits = c.app.repo.commits(skip=start, limit=limit, **params)
+        count = c.app.repo.commits_count(**params)
         revisions = M.repo.Commit.query.find({'_id': {'$in': commits}}).sort('committed.date',
-1)
         c.log_widget = self.log_widget
         return dict(

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/234d94e1/ForgeGit/forgegit/tests/functional/test_controllers.py
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/tests/functional/test_controllers.py b/ForgeGit/forgegit/tests/functional/test_controllers.py
index 8d3330c..c6e9cc8 100644
--- a/ForgeGit/forgegit/tests/functional/test_controllers.py
+++ b/ForgeGit/forgegit/tests/functional/test_controllers.py
@@ -94,7 +94,6 @@ class TestRootController(_TestCase):
                  u'message': u'Add README', u'row': 1})
 
     def test_log(self):
-        resp = self.app.get('/src-git/ref/master~/log/')
         resp = self.app.get('/src-git/ci/1e146e67985dcd71c74de79613719bef7bddca4a/log/')
         assert 'Initial commit' in resp
         assert 'Change README' in resp
@@ -102,7 +101,12 @@ class TestRootController(_TestCase):
         assert 'Change README ' in resp
         assert 'Add README ' in resp
         assert "Initial commit " not in resp
-        resp = self.app.get('/src-git/ci/1e146e67985dcd71c74de79613719bef7bddca4a/log/?path=/test')
+        resp = self.app.get('/src-git/ci/1e146e67985dcd71c74de79613719bef7bddca4a/log/?path=/a/b/c/')
+        assert 'Remove file' in resp
+        assert 'Initial commit' in resp
+        assert 'Add README' not in resp
+        assert 'Change README' not in resp
+        resp = self.app.get('/src-git/ci/1e146e67985dcd71c74de79613719bef7bddca4a/log/?path=/not/exist')
         assert 'No (more) commits' in resp
 
     def test_tags(self):

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/234d94e1/ForgeHg/forgehg/tests/functional/test_controllers.py
----------------------------------------------------------------------
diff --git a/ForgeHg/forgehg/tests/functional/test_controllers.py b/ForgeHg/forgehg/tests/functional/test_controllers.py
index c66e116..497b94b 100644
--- a/ForgeHg/forgehg/tests/functional/test_controllers.py
+++ b/ForgeHg/forgehg/tests/functional/test_controllers.py
@@ -174,13 +174,20 @@ class TestRootController(TestController):
         assert 'Cannot display: file marked as a binary type.' in resp
 
     def test_log(self):
-        r = self.app.get('/p/test/src-hg/ci/4a7f7ec0dcf5f005eb5d177b3d8c00bfc8159843/log/?path=')
+        r = self.app.get('/p/test/src-hg/ci/4a7f7ec0dcf5f005eb5d177b3d8c00bfc8159843/log/')
         assert "add test.jpg " in r
         assert "Add README" in r
+        assert "added binfile" not in r
         r = self.app.get('/p/test/src-hg/ci/4a7f7ec0dcf5f005eb5d177b3d8c00bfc8159843/log/?path=/README')
         assert "add test.jpg " not in r
         assert "Add README" in r
         assert "Modify README" in r
+        r = self.app.get('/p/test/src-hg/ci/4a7f7ec0dcf5f005eb5d177b3d8c00bfc8159843/log/?path=a/b/c')
+        assert "Remove dir structure" in r
+        assert "Add dir structure" in r
+        assert "Modify README" not in r
+        r = self.app.get('/p/test/src-hg/ci/e5a0b44437be783c41084e7bf0740f9b58b96ecf/log/?path=a/b/c')
+        assert "No (more) commits" in r
 
 
 class TestLogPagination(TestController):

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/234d94e1/ForgeSVN/forgesvn/tests/functional/test_controllers.py
----------------------------------------------------------------------
diff --git a/ForgeSVN/forgesvn/tests/functional/test_controllers.py b/ForgeSVN/forgesvn/tests/functional/test_controllers.py
index a093242..07e2fb0 100644
--- a/ForgeSVN/forgesvn/tests/functional/test_controllers.py
+++ b/ForgeSVN/forgesvn/tests/functional/test_controllers.py
@@ -119,14 +119,21 @@ class TestRootController(SVNTestController):
         assert 'value="a"' in r
 
     def test_log(self):
+        r = self.app.get('/src/1/log/')
+        assert 'Create readme' in r
         r = self.app.get('/src/2/log/?path=')
         assert "Create readme" in r
         assert "Add path " in r
         r = self.app.get('/src/2/log/?path=README')
-        assert "Modify readme" in r
-        assert "Remove hello.txt" not in r
+        assert "Modify readme" not in r
         assert "Create readme " in r
-        r = self.app.get('/src/2/log/?path=test')
+        r = self.app.get('/src/2/log/?path=/a/b/c/')
+        assert 'Add path' in r
+        assert 'Remove hello.txt' not in r
+        r = self.app.get('/src/5/log/?path=a/b/c/')
+        assert 'Add path' in r
+        assert 'Remove hello.txt' in r
+        r = self.app.get('/src/2/log/?path=does/not/exist/')
         assert 'No (more) commits' in r
 
 


Mime
View raw message