You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by he...@apache.org on 2015/08/18 21:29:50 UTC

[2/2] allura git commit: [#7963] Add tests for paged_diffs

[#7963] Add tests for paged_diffs


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

Branch: refs/heads/hs/7963
Commit: 497474035e4a7d3a6f678f192a3b61f5d51b20fd
Parents: c0474f2
Author: Heith Seewald <hs...@hsmb.local>
Authored: Tue Aug 18 15:29:19 2015 -0400
Committer: Heith Seewald <hs...@hsmb.local>
Committed: Tue Aug 18 15:29:19 2015 -0400

----------------------------------------------------------------------
 .../2d/14b961ade8540113df9107be045e4ae4136ac5   | Bin 0 -> 161 bytes
 .../34/6c52c1dddc729e2c2711f809336401f0ff925e   |   2 +
 .../3c/b2bbcd7997f89060a14fe8b1a363f01883087f   |   2 +
 .../3c/bb55013cbb01ccb8d473e686e1a57d9c489243   | Bin 0 -> 161 bytes
 .../5a/3a87cf4d70ddae8f993254fb78e7974b812852   | Bin 0 -> 168 bytes
 .../86/2e77e5e7b157ade8c862a0dd6e73383e0f919f   | Bin 0 -> 139 bytes
 .../96/060b218ad9724646371e479775c7f664c141d1   | Bin 0 -> 134 bytes
 .../b7/07968ce4752b27410cc1fc71ced036314d6fbe   | Bin 0 -> 168 bytes
 .../c6/0e405e7150f65b19a3622dfe983ca37d28fe53   | Bin 0 -> 162 bytes
 .../d4/018e3cd5ff24921c0d31076e8bb44f54e77ce0   | Bin 0 -> 36 bytes
 .../data/weird-chars.git/refs/heads/master      |   2 +-
 .../forgegit/tests/model/test_repository.py     |  59 +++++++++++++++++++
 12 files changed, 64 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/49747403/ForgeGit/forgegit/tests/data/weird-chars.git/objects/2d/14b961ade8540113df9107be045e4ae4136ac5
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/tests/data/weird-chars.git/objects/2d/14b961ade8540113df9107be045e4ae4136ac5 b/ForgeGit/forgegit/tests/data/weird-chars.git/objects/2d/14b961ade8540113df9107be045e4ae4136ac5
new file mode 100644
index 0000000..08a3877
Binary files /dev/null and b/ForgeGit/forgegit/tests/data/weird-chars.git/objects/2d/14b961ade8540113df9107be045e4ae4136ac5 differ

http://git-wip-us.apache.org/repos/asf/allura/blob/49747403/ForgeGit/forgegit/tests/data/weird-chars.git/objects/34/6c52c1dddc729e2c2711f809336401f0ff925e
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/tests/data/weird-chars.git/objects/34/6c52c1dddc729e2c2711f809336401f0ff925e b/ForgeGit/forgegit/tests/data/weird-chars.git/objects/34/6c52c1dddc729e2c2711f809336401f0ff925e
new file mode 100644
index 0000000..0d89789
--- /dev/null
+++ b/ForgeGit/forgegit/tests/data/weird-chars.git/objects/34/6c52c1dddc729e2c2711f809336401f0ff925e
@@ -0,0 +1,2 @@
+x��Mj�0��}
+]�aF���e�=�X�92�'8*�~M{����o��un΋\���B=G�R9kH�ۄ<���7?L��{���2��j�s�)3�#H"D!����w���>1�꾀]����>�s��^tyw,!g9��+�
/��?f���\����>����M�
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/allura/blob/49747403/ForgeGit/forgegit/tests/data/weird-chars.git/objects/3c/b2bbcd7997f89060a14fe8b1a363f01883087f
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/tests/data/weird-chars.git/objects/3c/b2bbcd7997f89060a14fe8b1a363f01883087f b/ForgeGit/forgegit/tests/data/weird-chars.git/objects/3c/b2bbcd7997f89060a14fe8b1a363f01883087f
new file mode 100644
index 0000000..f72de10
--- /dev/null
+++ b/ForgeGit/forgegit/tests/data/weird-chars.git/objects/3c/b2bbcd7997f89060a14fe8b1a363f01883087f
@@ -0,0 +1,2 @@
+x��M
+�0@a�9�\@��$���K��`�Lh���F��Eo��m>xe�籃u��WHA���\YAJD�P�AS�z�*��G*
+�ZYbK�Y�-S�]a��Fo����p��py�T�<l��ۜO�Rx��A��EKG�Z����'W�)�R������H�
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/allura/blob/49747403/ForgeGit/forgegit/tests/data/weird-chars.git/objects/3c/bb55013cbb01ccb8d473e686e1a57d9c489243
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/tests/data/weird-chars.git/objects/3c/bb55013cbb01ccb8d473e686e1a57d9c489243 b/ForgeGit/forgegit/tests/data/weird-chars.git/objects/3c/bb55013cbb01ccb8d473e686e1a57d9c489243
new file mode 100644
index 0000000..ab1097a
Binary files /dev/null and b/ForgeGit/forgegit/tests/data/weird-chars.git/objects/3c/bb55013cbb01ccb8d473e686e1a57d9c489243 differ

http://git-wip-us.apache.org/repos/asf/allura/blob/49747403/ForgeGit/forgegit/tests/data/weird-chars.git/objects/5a/3a87cf4d70ddae8f993254fb78e7974b812852
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/tests/data/weird-chars.git/objects/5a/3a87cf4d70ddae8f993254fb78e7974b812852 b/ForgeGit/forgegit/tests/data/weird-chars.git/objects/5a/3a87cf4d70ddae8f993254fb78e7974b812852
new file mode 100644
index 0000000..c5661ae
Binary files /dev/null and b/ForgeGit/forgegit/tests/data/weird-chars.git/objects/5a/3a87cf4d70ddae8f993254fb78e7974b812852 differ

http://git-wip-us.apache.org/repos/asf/allura/blob/49747403/ForgeGit/forgegit/tests/data/weird-chars.git/objects/86/2e77e5e7b157ade8c862a0dd6e73383e0f919f
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/tests/data/weird-chars.git/objects/86/2e77e5e7b157ade8c862a0dd6e73383e0f919f b/ForgeGit/forgegit/tests/data/weird-chars.git/objects/86/2e77e5e7b157ade8c862a0dd6e73383e0f919f
new file mode 100644
index 0000000..31448c7
Binary files /dev/null and b/ForgeGit/forgegit/tests/data/weird-chars.git/objects/86/2e77e5e7b157ade8c862a0dd6e73383e0f919f differ

http://git-wip-us.apache.org/repos/asf/allura/blob/49747403/ForgeGit/forgegit/tests/data/weird-chars.git/objects/96/060b218ad9724646371e479775c7f664c141d1
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/tests/data/weird-chars.git/objects/96/060b218ad9724646371e479775c7f664c141d1 b/ForgeGit/forgegit/tests/data/weird-chars.git/objects/96/060b218ad9724646371e479775c7f664c141d1
new file mode 100644
index 0000000..319159e
Binary files /dev/null and b/ForgeGit/forgegit/tests/data/weird-chars.git/objects/96/060b218ad9724646371e479775c7f664c141d1 differ

http://git-wip-us.apache.org/repos/asf/allura/blob/49747403/ForgeGit/forgegit/tests/data/weird-chars.git/objects/b7/07968ce4752b27410cc1fc71ced036314d6fbe
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/tests/data/weird-chars.git/objects/b7/07968ce4752b27410cc1fc71ced036314d6fbe b/ForgeGit/forgegit/tests/data/weird-chars.git/objects/b7/07968ce4752b27410cc1fc71ced036314d6fbe
new file mode 100644
index 0000000..e760d93
Binary files /dev/null and b/ForgeGit/forgegit/tests/data/weird-chars.git/objects/b7/07968ce4752b27410cc1fc71ced036314d6fbe differ

http://git-wip-us.apache.org/repos/asf/allura/blob/49747403/ForgeGit/forgegit/tests/data/weird-chars.git/objects/c6/0e405e7150f65b19a3622dfe983ca37d28fe53
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/tests/data/weird-chars.git/objects/c6/0e405e7150f65b19a3622dfe983ca37d28fe53 b/ForgeGit/forgegit/tests/data/weird-chars.git/objects/c6/0e405e7150f65b19a3622dfe983ca37d28fe53
new file mode 100644
index 0000000..33147cd
Binary files /dev/null and b/ForgeGit/forgegit/tests/data/weird-chars.git/objects/c6/0e405e7150f65b19a3622dfe983ca37d28fe53 differ

http://git-wip-us.apache.org/repos/asf/allura/blob/49747403/ForgeGit/forgegit/tests/data/weird-chars.git/objects/d4/018e3cd5ff24921c0d31076e8bb44f54e77ce0
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/tests/data/weird-chars.git/objects/d4/018e3cd5ff24921c0d31076e8bb44f54e77ce0 b/ForgeGit/forgegit/tests/data/weird-chars.git/objects/d4/018e3cd5ff24921c0d31076e8bb44f54e77ce0
new file mode 100644
index 0000000..d84e12d
Binary files /dev/null and b/ForgeGit/forgegit/tests/data/weird-chars.git/objects/d4/018e3cd5ff24921c0d31076e8bb44f54e77ce0 differ

http://git-wip-us.apache.org/repos/asf/allura/blob/49747403/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 ff3a92b..f76e179 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 @@
-f3de6a0e7601cdde326054a1cc708afdc1dbe70b
+346c52c1dddc729e2c2711f809336401f0ff925e

http://git-wip-us.apache.org/repos/asf/allura/blob/49747403/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 25daa62..0c524c3 100644
--- a/ForgeGit/forgegit/tests/model/test_repository.py
+++ b/ForgeGit/forgegit/tests/model/test_repository.py
@@ -650,6 +650,7 @@ class TestGitRepo(unittest.TestCase, RepoImplTestBase):
             tempfile.mkdtemp.return_value,
             ignore_errors=True)
 
+    @mock.patch.dict('allura.lib.app_globals.config',  {'scm.commits.detect_copies': 'false'})
     @td.with_tool('test', 'Git', 'src-weird', 'Git', type='git')
     def test_paged_diffs(self):
         # setup
@@ -722,6 +723,64 @@ class TestGitRepo(unittest.TestCase, RepoImplTestBase):
             'total': 2,
         }
         assert_equals(diffs, expected)
+        diffs = repo.paged_diffs('346c52c1dddc729e2c2711f809336401f0ff925e')  # Test copy
+        expected = {
+            'added': [u'README.copy'],
+            'removed': [],
+            'copied': [],
+            'renamed': [],
+            'changed': [u'README'],
+            'total': 2,
+        }
+        assert_equals(diffs, expected)
+        diffs = repo.paged_diffs('3cb2bbcd7997f89060a14fe8b1a363f01883087f')  # Test rename
+        expected = {
+            'added': [u'README'],
+            'removed': [u'README-copy.md'],
+            'copied': [],
+            'renamed': [],
+            'changed': [],
+            'total': 2,
+        }
+        assert_equals(diffs, expected)
+
+    @mock.patch.dict('allura.lib.app_globals.config',  {'scm.commits.detect_copies': 'true'})
+    @td.with_tool('test', 'Git', 'src-weird', 'Git', type='git')
+    def test_paged_diffs_with_detect_copies(self):
+        # setup
+        h.set_context('test', 'src-weird', neighborhood='Projects')
+        repo_dir = pkg_resources.resource_filename(
+            'forgegit', 'tests/data')
+        repo = GM.Repository(
+            name='weird-chars.git',
+            fs_path=repo_dir,
+            url_path='/src-weird/',
+            tool='git',
+            status='creating')
+        repo.refresh()
+        ThreadLocalORMSession.flush_all()
+        ThreadLocalORMSession.close_all()
+
+        diffs = repo.paged_diffs('346c52c1dddc729e2c2711f809336401f0ff925e')  # Test copy
+        expected = {
+            'added': [],
+            'removed': [],
+            'copied': [{'new': u'README.copy', 'old': u'README', 'ratio': 1.0}],
+            'renamed': [],
+            'changed': [u'README'],
+            'total': 2,
+        }
+        assert_equals(diffs, expected)
+        diffs = repo.paged_diffs('3cb2bbcd7997f89060a14fe8b1a363f01883087f')  # Test rename
+        expected = {
+            'added': [],
+            'removed': [],
+            'copied': [],
+            'renamed': [{'new': u'README', 'old': u'README-copy.md', 'ratio': 1.0}],
+            'changed': [],
+            'total': 1,
+        }
+        assert_equals(diffs, expected)
 
     def test_merge_base(self):
         res = self.repo._impl.merge_base(self.merge_request)