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:15 UTC
[1/2] allura git commit: [#8001] fix assertion typo;
add autospec=True params which will help catch such typos
Repository: allura
Updated Branches:
refs/heads/db/8001 [created] 88db44e08
[#8001] fix assertion typo; add autospec=True params which will help catch such typos
Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/88db44e0
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/88db44e0
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/88db44e0
Branch: refs/heads/db/8001
Commit: 88db44e08db4229d9c3c2d1062b897d77a5771bb
Parents: 65a704f
Author: Dave Brondsema <da...@brondsema.net>
Authored: Thu Aug 18 17:39:07 2016 -0400
Committer: Dave Brondsema <da...@brondsema.net>
Committed: Thu Aug 18 18:04:08 2016 -0400
----------------------------------------------------------------------
ForgeGit/forgegit/tests/model/test_repository.py | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/allura/blob/88db44e0/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 1121637..abf2f0a 100644
--- a/ForgeGit/forgegit/tests/model/test_repository.py
+++ b/ForgeGit/forgegit/tests/model/test_repository.py
@@ -217,7 +217,7 @@ class TestGitRepo(unittest.TestCase, RepoImplTestBase):
self.assertIn('exec $DIR/post-receive-user\n', c)
shutil.rmtree(dirname)
- @mock.patch('forgegit.model.git_repo.git.Repo.clone_from')
+ @mock.patch('forgegit.model.git_repo.git.Repo.clone_from', autospec=True)
def test_hotcopy(self, clone_from):
with h.push_config(tg.config, **{'scm.git.hotcopy': 'True'}):
repo = GM.Repository(
@@ -651,15 +651,15 @@ class TestGitRepo(unittest.TestCase, RepoImplTestBase):
tempfile.mkdtemp.return_value,
ignore_errors=True)
- @mock.patch('forgegit.model.git_repo.tempfile')
- @mock.patch('forgegit.model.git_repo.shutil')
- @mock.patch('forgegit.model.git_repo.git')
+ @mock.patch('forgegit.model.git_repo.tempfile', autospec=True)
+ @mock.patch('forgegit.model.git_repo.shutil', autospec=True)
+ @mock.patch('forgegit.model.git_repo.git', autospec=True)
def test_merge_raise_exception(self, git, shutil, tempfile):
self.repo._impl._git.git = mock.Mock()
git.Repo.clone_from.side_effect = Exception
with self.assertRaises(Exception):
self.repo.merge(mock.Mock())
- shutil.rmtree.assert_has_calles()
+ assert shutil.rmtree.called
@mock.patch.dict('allura.lib.app_globals.config', {'scm.commit.git.detect_copies': 'false'})
@td.with_tool('test', 'Git', 'src-weird', 'Git', type='git')
[2/2] allura git commit: [#8001] handle a git commit that has a file
type change in it
Posted by br...@apache.org.
[#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')