Pastebin

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
commit 74910c756d5f41c97b5e728604bf6bd0ada02199
Author: Dave Brondsema <dave@brondsema.net>
Date:   Fri Aug 19 14:21:26 2016 -0400

    [#8001] restore original logic for git paged_diffs total, and corresponding tests

diff --git ForgeGit/forgegit/model/git_repo.py ForgeGit/forgegit/model/git_repo.py
index 1a17884..a0bde96 100644
--- ForgeGit/forgegit/model/git_repo.py
+++ ForgeGit/forgegit/model/git_repo.py
@@ -706,21 +706,21 @@ def paged_diffs(self, commit_id, start=0, end=None, onlyChangedFiles=False):
                 'M': result['changed'],
                 'T': result['changed'],
             }
             if status in change_list_types:
                 change_list = change_list_types[status]
                 change_list.append(name)
             else:
                 log.error('Unexpected git change status: "%s" on file %s commit %s repo %s',
                           status, name, commit_id, self._repo.full_fs_path)

-        result['total'] = sum(len(chgs) for chgs in result.values())
+        result['total'] = len(files)

         return result

     @contextmanager
     def _shared_clone(self, from_path):
         tmp_path = tempfile.mkdtemp()
         start_time = time()
         self._git.git.clone('--bare', '--shared', from_path, tmp_path)
         tmp_repo = GitImplementation(Object(full_fs_path=tmp_path))
         log.info('Merge request view - shared clone timing: %s for %s', time()-start_time, from_path)
diff --git ForgeGit/forgegit/tests/model/test_repository.py ForgeGit/forgegit/tests/model/test_repository.py
index abf2f0a..3587231 100644
--- ForgeGit/forgegit/tests/model/test_repository.py
+++ ForgeGit/forgegit/tests/model/test_repository.py
@@ -714,31 +714,31 @@ def test_paged_diffs(self):
         assert_equals(diffs, expected)

         # pagination
         diffs = repo.paged_diffs('407950e8fba4dbc108ffbce0128ed1085c52cfd7', start=0, end=1)
         expected = {
             'added': [u'with space.txt'],
             'removed': [],
             'copied': [],
             'renamed': [],
             'changed': [],
-            'total': 1,
+            'total': 2,  # there are two total changes but result is limited to first
         }
         assert_equals(diffs, expected)
         diffs = repo.paged_diffs('407950e8fba4dbc108ffbce0128ed1085c52cfd7', start=1, end=2)
         expected = {
             'added': [u'привіт.txt'],
             'removed': [],
             'copied': [],
             'renamed': [],
             'changed': [],
-            'total': 1,
+            'total': 2,  # there are two total changes but result is limited to second
         }
         assert_equals(diffs, expected)
         diffs = repo.paged_diffs('346c52c1dddc729e2c2711f809336401f0ff925e')  # Test copy
         expected = {
             'added': [u'README.copy'],
             'removed': [],
             'copied': [],
             'renamed': [],
             'changed': [u'README'],
             'total': 2,