You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by br...@apache.org on 2016/08/18 22:04:16 UTC

[2/2] allura git commit: [#8001] handle a git commit that has a file type change in it

[#8001] handle a git commit that has a file type change in it


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

Branch: refs/heads/db/8001
Commit: 65a704f368c8aa47c1f73d58a8396506ae46aee8
Parents: 4155220
Author: Dave Brondsema <da...@brondsema.net>
Authored: Thu Aug 18 17:02:09 2016 -0400
Committer: Dave Brondsema <da...@brondsema.net>
Committed: Thu Aug 18 18:04:08 2016 -0400

----------------------------------------------------------------------
 ForgeGit/forgegit/model/git_repo.py                |  16 +++++++++++-----
 .../42/061c01a1c70097d1e4579f29a5adf40abdec95      | Bin 0 -> 24 bytes
 .../61/6d24f8dd4e95cadd8e93df5061f09855d1a066      | Bin 0 -> 197 bytes
 .../6b/58268f6cb02711d2f09e3ccd554f5c69994531      | Bin 0 -> 190 bytes
 .../tests/data/weird-chars.git/refs/heads/master   |   2 +-
 ForgeGit/forgegit/tests/model/test_repository.py   |  14 ++++++++++++--
 6 files changed, 24 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/65a704f3/ForgeGit/forgegit/model/git_repo.py
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/model/git_repo.py b/ForgeGit/forgegit/model/git_repo.py
index 82fa508..1a17884 100644
--- a/ForgeGit/forgegit/model/git_repo.py
+++ b/ForgeGit/forgegit/model/git_repo.py
@@ -698,16 +698,22 @@ class GitImplementation(M.RepositoryImplementation):
                 x += 2
 
         for status, name in files[start:end]:
-            change_list = {
+            change_list_types = {
                 'R': result['renamed'],
                 'C': result['copied'],
                 'A': result['added'],
                 'D': result['removed'],
-                'M': result['changed']
-            }[status]
-            change_list.append(name)
+                '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'] = len(files)
+        result['total'] = sum(len(chgs) for chgs in result.values())
 
         return result
 

http://git-wip-us.apache.org/repos/asf/allura/blob/65a704f3/ForgeGit/forgegit/tests/data/weird-chars.git/objects/42/061c01a1c70097d1e4579f29a5adf40abdec95
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/tests/data/weird-chars.git/objects/42/061c01a1c70097d1e4579f29a5adf40abdec95 b/ForgeGit/forgegit/tests/data/weird-chars.git/objects/42/061c01a1c70097d1e4579f29a5adf40abdec95
new file mode 100644
index 0000000..0a8f32e
Binary files /dev/null and b/ForgeGit/forgegit/tests/data/weird-chars.git/objects/42/061c01a1c70097d1e4579f29a5adf40abdec95 differ

http://git-wip-us.apache.org/repos/asf/allura/blob/65a704f3/ForgeGit/forgegit/tests/data/weird-chars.git/objects/61/6d24f8dd4e95cadd8e93df5061f09855d1a066
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/tests/data/weird-chars.git/objects/61/6d24f8dd4e95cadd8e93df5061f09855d1a066 b/ForgeGit/forgegit/tests/data/weird-chars.git/objects/61/6d24f8dd4e95cadd8e93df5061f09855d1a066
new file mode 100644
index 0000000..8b56af7
Binary files /dev/null and b/ForgeGit/forgegit/tests/data/weird-chars.git/objects/61/6d24f8dd4e95cadd8e93df5061f09855d1a066 differ

http://git-wip-us.apache.org/repos/asf/allura/blob/65a704f3/ForgeGit/forgegit/tests/data/weird-chars.git/objects/6b/58268f6cb02711d2f09e3ccd554f5c69994531
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/tests/data/weird-chars.git/objects/6b/58268f6cb02711d2f09e3ccd554f5c69994531 b/ForgeGit/forgegit/tests/data/weird-chars.git/objects/6b/58268f6cb02711d2f09e3ccd554f5c69994531
new file mode 100644
index 0000000..4b61a17
Binary files /dev/null and b/ForgeGit/forgegit/tests/data/weird-chars.git/objects/6b/58268f6cb02711d2f09e3ccd554f5c69994531 differ

http://git-wip-us.apache.org/repos/asf/allura/blob/65a704f3/ForgeGit/forgegit/tests/data/weird-chars.git/refs/heads/master
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/tests/data/weird-chars.git/refs/heads/master b/ForgeGit/forgegit/tests/data/weird-chars.git/refs/heads/master
index f76e179..20663de 100644
--- a/ForgeGit/forgegit/tests/data/weird-chars.git/refs/heads/master
+++ b/ForgeGit/forgegit/tests/data/weird-chars.git/refs/heads/master
@@ -1 +1 @@
-346c52c1dddc729e2c2711f809336401f0ff925e
+616d24f8dd4e95cadd8e93df5061f09855d1a066

http://git-wip-us.apache.org/repos/asf/allura/blob/65a704f3/ForgeGit/forgegit/tests/model/test_repository.py
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/tests/model/test_repository.py b/ForgeGit/forgegit/tests/model/test_repository.py
index c281603..1121637 100644
--- a/ForgeGit/forgegit/tests/model/test_repository.py
+++ b/ForgeGit/forgegit/tests/model/test_repository.py
@@ -721,7 +721,7 @@ class TestGitRepo(unittest.TestCase, RepoImplTestBase):
             'copied': [],
             'renamed': [],
             'changed': [],
-            'total': 2,
+            'total': 1,
         }
         assert_equals(diffs, expected)
         diffs = repo.paged_diffs('407950e8fba4dbc108ffbce0128ed1085c52cfd7', start=1, end=2)
@@ -731,7 +731,7 @@ class TestGitRepo(unittest.TestCase, RepoImplTestBase):
             'copied': [],
             'renamed': [],
             'changed': [],
-            'total': 2,
+            'total': 1,
         }
         assert_equals(diffs, expected)
         diffs = repo.paged_diffs('346c52c1dddc729e2c2711f809336401f0ff925e')  # Test copy
@@ -754,6 +754,16 @@ class TestGitRepo(unittest.TestCase, RepoImplTestBase):
             'total': 2,
         }
         assert_equals(diffs, expected)
+        diffs = repo.paged_diffs('616d24f8dd4e95cadd8e93df5061f09855d1a066')  # Test type change
+        expected = {
+            'added': [],
+            'removed': [],
+            'copied': [],
+            'renamed': [],
+            'changed': [u'README.copy'],
+            'total': 1,
+        }
+        assert_equals(diffs, expected)
 
     @mock.patch.dict('allura.lib.app_globals.config',  {'scm.commit.git.detect_copies': 'true'})
     @td.with_tool('test', 'Git', 'src-weird', 'Git', type='git')