allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brond...@apache.org
Subject [3/3] allura git commit: [#5496] do pagination of browse_commits page for hg/git; calculate columns client-side now
Date Mon, 24 Oct 2016 20:08:55 GMT
[#5496] do pagination of browse_commits page for hg/git; calculate columns client-side now


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

Branch: refs/heads/db/5496
Commit: 61ab321bcc7fd01dc394b04a5a0a697c58b1074f
Parents: 590a5ca
Author: Dave Brondsema <dave@brondsema.net>
Authored: Mon Oct 24 13:50:31 2016 -0400
Committer: Dave Brondsema <dave@brondsema.net>
Committed: Mon Oct 24 16:08:36 2016 -0400

----------------------------------------------------------------------
 Allura/allura/controllers/repository.py         |  75 +++++++-------
 .../lib/widgets/resources/js/commit_browser.js  | 100 ++++++++++++++++---
 Allura/allura/model/repository.py               |  11 +-
 ForgeGit/forgegit/model/git_repo.py             |   7 +-
 .../tests/functional/test_controllers.py        |   3 -
 ForgeSVN/forgesvn/model/svn.py                  |   6 +-
 ForgeSVN/forgesvn/svn_main.py                   |   2 +-
 .../forgesvn/tests/model/test_repository.py     |  38 +++----
 8 files changed, 155 insertions(+), 87 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/61ab321b/Allura/allura/controllers/repository.py
----------------------------------------------------------------------
diff --git a/Allura/allura/controllers/repository.py b/Allura/allura/controllers/repository.py
index 09743f8..8a02905 100644
--- a/Allura/allura/controllers/repository.py
+++ b/Allura/allura/controllers/repository.py
@@ -18,9 +18,9 @@
 import os
 import logging
 import difflib
+from datetime import datetime
 from urllib import quote, unquote
 from collections import defaultdict, OrderedDict
-from itertools import islice
 
 from paste.deploy.converters import asbool
 from pylons import tmpl_context as c, app_globals as g
@@ -222,14 +222,31 @@ class RepoRootController(BaseController, FeedController):
 
     @without_trailing_slash
     @expose('json:')
-    def commit_browser_data(self, **kw):
-        head_ids = [head.object_id for head in c.app.repo.get_heads()]
-        commit_ids = [c.app.repo.rev_to_commit_id(r)
-                      for r in c.app.repo.log(head_ids, id_only=True)]
+    def commit_browser_data(self, start=None, limit=50, **kw):
+        log.debug('Start commit_browser_data')
+
+        if start:
+            head_ids = start.split(',')
+        else:
+            # master, and any other branches
+            head_ids = [head.object_id for head in c.app.repo.get_heads()]
+        log.debug('Got %s heads', len(head_ids))
+
+        # recent commits from any head
+        heads_log = list(c.app.repo.log(head_ids, id_only=True, limit=int(limit)))
+        log.debug('Did log lookup')
+        commit_ids = [c.app.repo.rev_to_commit_id(r) for r in heads_log]
+
+        # any we didn't get to will be attempted in next page of commits
+        next_page_commits = list(set(head_ids) - set(commit_ids))
+        # and remove any heads that didn't come through from further processing
+        head_ids = set(head_ids).intersection(set(commit_ids))
+
         log.info('Grab %d commit objects by ID', len(commit_ids))
         commits_by_id = {
             c_obj._id: c_obj
             for c_obj in M.repository.CommitDoc.m.find(dict(_id={'$in': commit_ids}))}
+
         log.info('... build graph')
         parents = {}
         children = defaultdict(list)
@@ -240,7 +257,11 @@ class RepoRootController(BaseController, FeedController):
             for p_oid in ci.parent_ids:
                 children[p_oid].append(oid)
         result = []
-        for row, oid in enumerate(topo_sort(children, parents, dates, head_ids)):
+        row = 0
+        for oid in topo_sort(children, parents, dates, head_ids):
+            if oid not in commits_by_id:
+                next_page_commits.append(oid)
+                continue
             ci = commits_by_id[oid]
             url = c.app.repo.url_for_commit(Object(_id=oid))
             msg_split = ci.message.splitlines()
@@ -255,38 +276,14 @@ class RepoRootController(BaseController, FeedController):
                 parents=ci.parent_ids,
                 message=msg,
                 url=url))
+            row += 1
+
+        built_tree = OrderedDict((ci_json['oid'], ci_json) for ci_json in result)
         log.info('...done')
-        col_idx = {}
-        columns = []
-
-        def find_column(columns):
-            for i, col in enumerate(columns):
-                if col is None:
-                    return i
-            columns.append(None)
-            return len(columns) - 1
-        for row, ci_json in enumerate(result):
-            oid = ci_json['oid']
-            colno = col_idx.get(oid)
-            if colno is None:
-                colno = find_column(columns)
-                col_idx[oid] = colno
-            columns[colno] = None
-            ci_json['column'] = colno
-            for p in parents[oid]:
-                p_col = col_idx.get(p, None)
-                if p_col is not None:
-                    continue
-                p_col = find_column(columns)
-                col_idx[p] = p_col
-                columns[p_col] = p
-        built_tree = dict(
-            (ci_json['oid'], ci_json) for ci_json in result)
         return dict(
-            commits=[ci_json['oid'] for ci_json in result],
             built_tree=built_tree,
-            next_column=len(columns),
-            max_row=row)
+            next_commit=','.join(next_page_commits),
+        )
 
     @expose('json:')
     def status(self, **kw):
@@ -309,7 +306,7 @@ class RepoRestController(RepoRootController, AppRestControllerMixin):
         Return 120 latest commits  : /rest/p/code/logs/?limit=120
         '''
 
-        revisions = islice(c.app.repo.log(rev, id_only=False), int(limit))
+        revisions = c.app.repo.log(rev, id_only=False, limit=int(limit))
 
         return {
             'commits': [
@@ -638,11 +635,11 @@ class CommitBrowser(BaseController):
         if path:
             is_file = c.app.repo.is_file(path, self._commit._id)
         limit, _ = h.paging_sanitizer(limit, 0)
-        commits = list(islice(c.app.repo.log(
+        commits = list(c.app.repo.log(
             revs=self._commit._id,
             path=path,
             id_only=False,
-            page_size=limit + 1), limit + 1))
+            limit=limit + 1))  # get an extra one to check for a next commit
         next_commit = None
         if len(commits) > limit:
             next_commit = commits.pop()
@@ -827,7 +824,7 @@ def topo_sort(children, parents, dates, head_ids):
             continue
         visited.add(next)
         yield next
-        for p in parents[next]:
+        for p in parents.get(next, []):
             for child in children[p]:
                 if child not in visited:
                     break

http://git-wip-us.apache.org/repos/asf/allura/blob/61ab321b/Allura/allura/lib/widgets/resources/js/commit_browser.js
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/widgets/resources/js/commit_browser.js b/Allura/allura/lib/widgets/resources/js/commit_browser.js
index b016b87..ff3d2bb 100644
--- a/Allura/allura/lib/widgets/resources/js/commit_browser.js
+++ b/Allura/allura/lib/widgets/resources/js/commit_browser.js
@@ -65,11 +65,11 @@ if($('#commit_graph')){
     var point_size = 10;
     var page_size = 15;
 
-    var data = {'commits': [], 'built_tree': {}};
+    var data = {'built_tree': {}};
     var offset = 1;
     var selected_commit = -1;
     var y_offset = offset * y_space;
-    var tree, next_column, max_x_pos, max_row = 0, next_row = 0, max_visible_row;
+    var tree, next_column = 0, max_row = 0, next_row = 0, max_visible_row;
 
     var $graph_holder = $('#graph_holder');
     var $scroll_placeholder = $('#graph_scroll_placeholder');
@@ -124,18 +124,16 @@ if($('#commit_graph')){
                 var parent_x = x_space+parent.column*x_space
                 var parent_y = y_space+(parent.row-offset)*y_space;
 
-                canvas_ctx.strokeStyle = color(parent.column % 6);
+                canvas_ctx.strokeStyle = color(Math.max(commit.column, parent.column) % 6);
 
-                // Vertical
-                canvas_ctx.beginPath();
-                canvas_ctx.moveTo(parent_x+point_offset, y_pos+y_space);
-                canvas_ctx.lineTo(parent_x+point_offset, parent_y+point_offset);
-                canvas_ctx.stroke();
-
-                // Diagonal
                 canvas_ctx.beginPath()
                 canvas_ctx.moveTo(x_pos + point_offset, y_pos+point_offset);
-                canvas_ctx.lineTo(parent_x+point_offset, y_pos+y_space);
+                if (parent_x > x_pos) {
+                    canvas_ctx.lineTo(parent_x + point_offset, y_pos + y_space + point_offset);
// out to the right to parent column, next row
+                } else {
+                    canvas_ctx.lineTo(x_pos + point_offset, parent_y - y_space + point_offset);
// straight down, to point one higher than parent (might not go down at all)
+                }
+                canvas_ctx.lineTo(parent_x+point_offset, parent_y+point_offset); // go to
parent
                 canvas_ctx.stroke();
             }
         }
@@ -168,16 +166,88 @@ if($('#commit_graph')){
         }
         pending = true;
         drawGraph(offset);
-        var params = {'limit': 50};
+        var params = {'limit': 500};
         if (data['next_commit']) {
             params['start'] = data['next_commit'];
         }
         $.getJSON(document.location.href+'_data', params, function(new_data) {
             $.extend(true, data, new_data);
             tree = data['built_tree'];
-            next_column = data['next_column'];
-            max_x_pos = x_space*next_column;
-            max_row = next_row + data['max_row']
+
+            // Calculate columns
+            var used_columns = [];
+            function take_next_free_column() {
+                // default to next bigger one
+                var col = used_columns.length;
+                // go through each and see if any are missing, and use that
+                for (var i = 0; i < used_columns.length; i++) {
+                    if (used_columns.indexOf(i) === -1) {
+                        col = i;
+                        break;
+                    }
+                }
+                used_columns.push(col);
+                next_column = Math.max(next_column, col);
+                return col;
+
+            }
+            for(var c in tree) {
+                var commit = tree[c];
+                if (commit.column === undefined) {
+                    commit.column = take_next_free_column();
+                } else {
+                    // when reprocessing data after ajax load, make sure we mark what is
used
+                    if (used_columns.indexOf(commit.column) === -1) {
+                        used_columns.push(commit.column);
+                    }
+                }
+                if (commit.columns_now_free !== undefined) {
+                    for (var i = 0; i < commit.columns_now_free.length; i++) {
+                        var col_idx = used_columns.indexOf(commit.columns_now_free[i]);
+                        used_columns.splice(col_idx, 1);  // splice == remove
+                    }
+                }
+                for(var p=0; p < commit.parents.length; p++) {
+                    var parent_id = commit.parents[p];
+                    var parent_commit = tree[parent_id];
+                    if (parent_commit) {
+                        // parent may not be available (we haven't loaded all the commits
yet)
+                        if (!(parent_id in new_data['built_tree'])) {
+                            // console.log('skipping ', parent_id, 'because it is not new,
don't want to change it');
+                        } else if (parent_commit.column !== undefined) {
+                            // parent already has column assigned (common ancestor of 2 branches)
+                            var first_col = Math.min(commit.column, parent_commit.column);
+                            var second_col = Math.max(commit.column, parent_commit.column);
+                            var columns_in_between = false;
+                            for (var i = first_col + 1; i < second_col; i++) {
+                                if (used_columns.indexOf(i) !== -1) {
+                                    columns_in_between = true;
+                                    break;
+                                }
+                            }
+                            parent_commit.columns_now_free = parent_commit.columns_now_free
|| [];
+                            if (columns_in_between) {
+                                // this isn't very frequent, but if it occurs, we can't change
the column like we do
+                                // in the "else" portion, since that would cause lines to
overlap
+                                parent_commit.columns_now_free.push(commit.column);
+                            } else {
+                                // ok to merge into the first column
+                                parent_commit.column = first_col;
+                                parent_commit.columns_now_free.push(second_col);
+                            }
+                        } else if (p === 0) {
+                            // first parent, stay in same column
+                            parent_commit.column = commit.column;
+                        } else {
+                            // additional parents, need separate columns
+                            parent_commit.column = take_next_free_column();
+                        }
+                    }
+                }
+            }
+
+            var new_commits_row = Object.keys(new_data['built_tree']).length - 1;
+            max_row = next_row + new_commits_row;
             max_visible_row = max_row + (data['next_commit'] ? 1 : 0);  // accounts for Show
More link
             for (var c in new_data['built_tree']) {
                 tree[c].row += next_row;

http://git-wip-us.apache.org/repos/asf/allura/blob/61ab321b/Allura/allura/model/repository.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/repository.py b/Allura/allura/model/repository.py
index 2f265fd..c5e8b2c 100644
--- a/Allura/allura/model/repository.py
+++ b/Allura/allura/model/repository.py
@@ -29,7 +29,7 @@ from collections import defaultdict, OrderedDict
 from urlparse import urljoin
 from threading import Thread
 from Queue import Queue
-from itertools import chain
+from itertools import chain, islice
 from difflib import SequenceMatcher
 
 import tg
@@ -534,7 +534,7 @@ class Repository(Artifact, ActivityObject):
         g.post_event('repo_cloned', source_url, source_path)
         self.refresh(notify=False, new_clone=True)
 
-    def log(self, revs=None, path=None, exclude=None, id_only=True, **kw):
+    def log(self, revs=None, path=None, exclude=None, id_only=True, limit=None, **kw):
         """
         Returns a generator that returns information about commits reachable
         by revs which modify path.
@@ -558,7 +558,8 @@ class Repository(Artifact, ActivityObject):
             revs = [revs]
         if exclude is not None and not isinstance(exclude, (list, tuple)):
             exclude = [exclude]
-        return self._impl.log(revs, path, exclude=exclude, id_only=id_only, **kw)
+        log_iter = self._impl.log(revs, path, exclude=exclude, id_only=id_only, limit=limit,
**kw)
+        return islice(log_iter, limit)
 
     def latest(self, branch=None):
         if self._impl is None:
@@ -1540,7 +1541,7 @@ class LastCommit(RepoObject):
     @classmethod
     def _last_commit_id(cls, commit, path):
         try:
-            rev = commit.repo.log(commit._id, path, id_only=True).next()
+            rev = commit.repo.log(commit._id, path, id_only=True, limit=1).next()
             return commit.repo.rev_to_commit_id(rev)
         except StopIteration:
             log.error('Tree node not recognized by SCM: %s @ %s',
@@ -1555,7 +1556,7 @@ class LastCommit(RepoObject):
         if lcid_cache != '' and path in lcid_cache:
             return lcid_cache[path]
         try:
-            log_iter = commit.repo.log(commit._id, path, id_only=True)
+            log_iter = commit.repo.log(commit._id, path, id_only=True, limit=2)
             log_iter.next()
             rev = log_iter.next()
             return commit.repo.rev_to_commit_id(rev)

http://git-wip-us.apache.org/repos/asf/allura/blob/61ab321b/ForgeGit/forgegit/model/git_repo.py
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/model/git_repo.py b/ForgeGit/forgegit/model/git_repo.py
index a0bde96..58572fc 100644
--- a/ForgeGit/forgegit/model/git_repo.py
+++ b/ForgeGit/forgegit/model/git_repo.py
@@ -328,7 +328,7 @@ class GitImplementation(M.RepositoryImplementation):
         doc.m.save(safe=False)
         return doc
 
-    def log(self, revs=None, path=None, exclude=None, id_only=True, **kw):
+    def log(self, revs=None, path=None, exclude=None, id_only=True, limit=None, **kw):
         """
         Returns a generator that returns information about commits reachable
         by revs.
@@ -354,7 +354,10 @@ class GitImplementation(M.RepositoryImplementation):
         args = ['--name-status', revs, '--', path]
         if path:
             args = ['--follow'] + args
-        for ci, refs, renamed in self._iter_commits_with_refs(*args):
+        kwargs = {}
+        if limit:
+            kwargs['n'] = limit
+        for ci, refs, renamed in self._iter_commits_with_refs(*args, **kwargs):
             if id_only:
                 yield ci.hexsha
             else:

http://git-wip-us.apache.org/repos/asf/allura/blob/61ab321b/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 fc0b755..1d612c6 100644
--- a/ForgeGit/forgegit/tests/functional/test_controllers.py
+++ b/ForgeGit/forgegit/tests/functional/test_controllers.py
@@ -146,14 +146,11 @@ class TestRootController(_TestCase):
     def test_commit_browser_data(self):
         resp = self.app.get('/src-git/commit_browser_data')
         data = json.loads(resp.body)
-        assert data['max_row'] == 4
-        assert data['next_column'] == 1
         assert_equal(
             data['built_tree']['df30427c488aeab84b2352bdf88a3b19223f9d7a'],
             {u'url': u'/p/test/src-git/ci/df30427c488aeab84b2352bdf88a3b19223f9d7a/',
              u'oid': u'df30427c488aeab84b2352bdf88a3b19223f9d7a',
              u'short_id': u'[df3042]',
-             u'column': 0,
              u'parents': [u'6a45885ae7347f1cac5103b0050cc1be6a1496c8'],
              u'message': u'Add README', u'row': 2})
 

http://git-wip-us.apache.org/repos/asf/allura/blob/61ab321b/ForgeSVN/forgesvn/model/svn.py
----------------------------------------------------------------------
diff --git a/ForgeSVN/forgesvn/model/svn.py b/ForgeSVN/forgesvn/model/svn.py
index 4759efc..5d1f533 100644
--- a/ForgeSVN/forgesvn/model/svn.py
+++ b/ForgeSVN/forgesvn/model/svn.py
@@ -479,7 +479,7 @@ class SVNImplementation(M.RepositoryImplementation):
         else:
             return self._blob_oid(commit_id, path)
 
-    def log(self, revs=None, path=None, exclude=None, id_only=True, page_size=25, **kw):
+    def log(self, revs=None, path=None, exclude=None, id_only=True, limit=25, **kw):
         """
         Returns a generator that returns information about commits reachable
         by revs.
@@ -519,7 +519,7 @@ class SVNImplementation(M.RepositoryImplementation):
             rev = pysvn.Revision(pysvn.opt_revision_kind.number, revno)
             try:
                 logs = self._svn.log(
-                    url, revision_start=rev, peg_revision=rev, limit=page_size,
+                    url, revision_start=rev, peg_revision=rev, limit=limit,
                     discover_changed_paths=True)
             except pysvn.ClientError as e:
                 if 'Unable to connect' in e.message:
@@ -533,7 +533,7 @@ class SVNImplementation(M.RepositoryImplementation):
                     yield ci.revision.number
                 else:
                     yield self._map_log(ci, url, path)
-            if len(logs) < page_size:
+            if len(logs) < limit:
                 # we didn't get a full page, don't bother calling SVN again
                 return
             revno = ci.revision.number - 1

http://git-wip-us.apache.org/repos/asf/allura/blob/61ab321b/ForgeSVN/forgesvn/svn_main.py
----------------------------------------------------------------------
diff --git a/ForgeSVN/forgesvn/svn_main.py b/ForgeSVN/forgesvn/svn_main.py
index a1d3061..37febd3 100644
--- a/ForgeSVN/forgesvn/svn_main.py
+++ b/ForgeSVN/forgesvn/svn_main.py
@@ -197,7 +197,7 @@ class SVNCommitBrowserController(BaseController):
             'next_commit': None,
         }
         limit, _ = h.paging_sanitizer(limit or 100, 0, 0)
-        for i, commit in enumerate(c.app.repo.log(revs=start, id_only=False, page_size=limit+1)):
+        for i, commit in enumerate(c.app.repo.log(revs=start, id_only=False, limit=limit+1)):
             if i >= limit:
                 data['next_commit'] = str(commit['id'])
                 break

http://git-wip-us.apache.org/repos/asf/allura/blob/61ab321b/ForgeSVN/forgesvn/tests/model/test_repository.py
----------------------------------------------------------------------
diff --git a/ForgeSVN/forgesvn/tests/model/test_repository.py b/ForgeSVN/forgesvn/tests/model/test_repository.py
index 1023394..18ec0fa 100644
--- a/ForgeSVN/forgesvn/tests/model/test_repository.py
+++ b/ForgeSVN/forgesvn/tests/model/test_repository.py
@@ -83,7 +83,7 @@ class TestNewRepo(unittest.TestCase):
         assert self.rev.shorthand_id() == '[r6]'
         assert self.rev.symbolic_ids == ([], [])
         assert self.rev.url() == '/p/test/src/6/'
-        all_cis = list(self.repo.log(self.rev._id))
+        all_cis = list(self.repo.log(self.rev._id, limit=25))
         assert len(all_cis) == 6
         self.rev.tree.ls()
         assert self.rev.tree.readme() == ('README', 'This is readme\nAnother Line\n')
@@ -171,7 +171,7 @@ class TestSVNRepo(unittest.TestCase, RepoImplTestBase):
         self.assertIn('exec $DIR/post-commit-user "$@"\n', hook_data)
 
         repo.refresh(notify=False)
-        assert len(list(repo.log()))
+        assert len(list(repo.log(limit=100)))
 
         shutil.rmtree(dirname)
 
@@ -222,7 +222,7 @@ class TestSVNRepo(unittest.TestCase, RepoImplTestBase):
         self.assertIn('exec $DIR/post-commit-user "$@"\n', c)
 
         repo.refresh(notify=False)
-        assert len(list(repo.log()))
+        assert len(list(repo.log(limit=100)))
 
         shutil.rmtree(dirname)
 
@@ -231,11 +231,11 @@ class TestSVNRepo(unittest.TestCase, RepoImplTestBase):
         assert i['type_s'] == 'SVN Repository', i
 
     def test_log_id_only(self):
-        entries = list(self.repo.log(id_only=True))
+        entries = list(self.repo.log(id_only=True, limit=25))
         assert_equal(entries, [6, 5, 4, 3, 2, 1])
 
     def test_log(self):
-        entries = list(self.repo.log(id_only=False))
+        entries = list(self.repo.log(id_only=False, limit=25))
         assert_equal(entries, [
             {'parents': [5],
              'refs': ['HEAD'],
@@ -322,7 +322,7 @@ class TestSVNRepo(unittest.TestCase, RepoImplTestBase):
              'size': None}])
 
     def test_log_file(self):
-        entries = list(self.repo.log(path='/README', id_only=False))
+        entries = list(self.repo.log(path='/README', id_only=False, limit=25))
         assert_equal(entries, [
             {'authored': {'date': datetime(2010, 10, 8, 15, 32, 48, 272296),
                           'email': '',
@@ -355,7 +355,7 @@ class TestSVNRepo(unittest.TestCase, RepoImplTestBase):
         assert not self.repo.is_file('/a')
 
     def test_paged_diffs(self):
-        entry = self.repo.commit(self.repo.log(2, id_only=True).next())
+        entry = self.repo.commit(self.repo.log(2, id_only=True, limit=1).next())
         self.assertEqual(entry.diffs, entry.paged_diffs())
         self.assertEqual(entry.diffs, entry.paged_diffs(start=0))
         added_expected = entry.diffs.added[1:3]
@@ -370,14 +370,14 @@ class TestSVNRepo(unittest.TestCase, RepoImplTestBase):
         self.assertEqual(sorted(actual.keys()), sorted(empty.keys()))
 
     def test_diff_create_file(self):
-        entry = self.repo.commit(self.repo.log(1, id_only=True).next())
+        entry = self.repo.commit(self.repo.log(1, id_only=True, limit=1).next())
         self.assertEqual(
             entry.diffs, dict(
                 copied=[], changed=[], renamed=[],
                 removed=[], added=['/README'], total=1))
 
     def test_diff_create_path(self):
-        entry = self.repo.commit(self.repo.log(2, id_only=True).next())
+        entry = self.repo.commit(self.repo.log(2, id_only=True, limit=1).next())
         actual = entry.diffs
         actual.added = sorted(actual.added)
         self.assertEqual(
@@ -388,21 +388,21 @@ class TestSVNRepo(unittest.TestCase, RepoImplTestBase):
                     '/a/b/c/hello.txt']), total=4))
 
     def test_diff_modify_file(self):
-        entry = self.repo.commit(self.repo.log(3, id_only=True).next())
+        entry = self.repo.commit(self.repo.log(3, id_only=True, limit=1).next())
         self.assertEqual(
             entry.diffs, dict(
                 copied=[], changed=['/README'], renamed=[],
                 removed=[], added=[], total=1))
 
     def test_diff_delete(self):
-        entry = self.repo.commit(self.repo.log(4, id_only=True).next())
+        entry = self.repo.commit(self.repo.log(4, id_only=True, limit=1).next())
         self.assertEqual(
             entry.diffs, dict(
                 copied=[], changed=[], renamed=[],
                 removed=['/a/b/c/hello.txt'], added=[], total=1))
 
     def test_diff_copy(self):
-        entry = self.repo.commit(self.repo.log(5, id_only=True).next())
+        entry = self.repo.commit(self.repo.log(5, id_only=True, limit=1).next())
         assert_equals(dict(entry.diffs), dict(
                 copied=[{'new': u'/b', 'old': u'/a', 'ratio': 1}],  renamed=[],
                 changed=[], removed=[], added=[], total=1))
@@ -664,18 +664,18 @@ class TestSVNRev(unittest.TestCase):
 
     def test_log(self):
         # path only
-        commits = list(self.repo.log(self.repo.head, id_only=True))
+        commits = list(self.repo.log(self.repo.head, id_only=True, limit=25))
         assert_equal(commits, [6, 5, 4, 3, 2, 1])
-        commits = list(self.repo.log(self.repo.head, 'README', id_only=True))
+        commits = list(self.repo.log(self.repo.head, 'README', id_only=True, limit=25))
         assert_equal(commits, [3, 1])
-        commits = list(self.repo.log(1, 'README', id_only=True))
+        commits = list(self.repo.log(1, 'README', id_only=True, limit=25))
         assert_equal(commits, [1])
-        commits = list(self.repo.log(self.repo.head, 'a/b/c/', id_only=True))
+        commits = list(self.repo.log(self.repo.head, 'a/b/c/', id_only=True, limit=25))
         assert_equal(commits, [4, 2])
-        commits = list(self.repo.log(3, 'a/b/c/', id_only=True))
+        commits = list(self.repo.log(3, 'a/b/c/', id_only=True, limit=25))
         assert_equal(commits, [2])
         assert_equal(
-            list(self.repo.log(self.repo.head, 'does/not/exist', id_only=True)), [])
+            list(self.repo.log(self.repo.head, 'does/not/exist', id_only=True, limit=25)),
[])
 
     def test_notification_email(self):
         setup_global_objects()
@@ -1101,7 +1101,7 @@ class TestRename(unittest.TestCase):
         ThreadLocalORMSession.close_all()
 
     def test_log_file_with_rename(self):
-        entry = list(self.repo.log(path='/dir/b.txt', id_only=False))[0]
+        entry = list(self.repo.log(path='/dir/b.txt', id_only=False, limit=1))[0]
         assert_equal(entry['id'], 3)
         assert_equal(entry['rename_details']['path'], '/dir/a.txt')
         assert_equal(


Mime
View raw message