bzr branch
http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar
|
6645.1.1
by Jelmer Vernooij
Bundle the stats plugin. |
1 |
from ...tests import TestCase, TestCaseWithTransport |
2 |
from ...revision import Revision |
|
3 |
from .cmds import get_revisions_and_committers, collapse_by_person |
|
|
0.140.35
by John Arbash Meinel
Merge Lukas's extra tests, update for the new code. |
4 |
|
5 |
||
6 |
class TestGetRevisionsAndCommitters(TestCaseWithTransport): |
|
|
0.150.4
by Lukáš Lalinský
Add email disambiguation to differentiate between empty emails + tests |
7 |
|
8 |
def test_simple(self): |
|
9 |
wt = self.make_branch_and_tree('.') |
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
10 |
wt.commit(message='1', committer='Fero <fero@example.com>', rev_id=b'1') |
11 |
wt.commit(message='2', committer='Fero <fero@example.com>', rev_id=b'2') |
|
12 |
wt.commit(message='3', committer='Jano <jano@example.com>', rev_id=b'3') |
|
|
0.140.35
by John Arbash Meinel
Merge Lukas's extra tests, update for the new code. |
13 |
wt.commit(message='4', committer='Jano <jano@example.com>', |
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
14 |
authors=['Vinco <vinco@example.com>'], rev_id=b'4') |
15 |
wt.commit(message='5', committer='Ferko <fero@example.com>', rev_id=b'5') |
|
|
0.140.35
by John Arbash Meinel
Merge Lukas's extra tests, update for the new code. |
16 |
revs, committers = get_revisions_and_committers(wt.branch.repository, |
|
6973.12.10
by Jelmer Vernooij
Fix remaining tests. |
17 |
[b'1', b'2', b'3', b'4', b'5']) |
|
0.140.35
by John Arbash Meinel
Merge Lukas's extra tests, update for the new code. |
18 |
fero = ('Fero', 'fero@example.com') |
19 |
jano = ('Jano', 'jano@example.com') |
|
20 |
vinco = ('Vinco', 'vinco@example.com') |
|
21 |
ferok = ('Ferko', 'fero@example.com') |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
22 |
self.assertEqual({fero: fero, jano: jano, vinco: vinco, ferok: fero}, |
|
0.140.35
by John Arbash Meinel
Merge Lukas's extra tests, update for the new code. |
23 |
committers) |
|
0.150.4
by Lukáš Lalinský
Add email disambiguation to differentiate between empty emails + tests |
24 |
|
25 |
def test_empty_email(self): |
|
26 |
wt = self.make_branch_and_tree('.') |
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
27 |
wt.commit(message='1', committer='Fero', rev_id=b'1') |
28 |
wt.commit(message='2', committer='Fero', rev_id=b'2') |
|
29 |
wt.commit(message='3', committer='Jano', rev_id=b'3') |
|
|
0.140.35
by John Arbash Meinel
Merge Lukas's extra tests, update for the new code. |
30 |
revs, committers = get_revisions_and_committers(wt.branch.repository, |
|
6973.12.10
by Jelmer Vernooij
Fix remaining tests. |
31 |
[b'1', b'2', b'3']) |
|
0.140.35
by John Arbash Meinel
Merge Lukas's extra tests, update for the new code. |
32 |
self.assertEqual({('Fero', ''): ('Fero', ''), |
33 |
('Jano', ''): ('Jano', ''), |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
34 |
}, committers) |
|
0.140.35
by John Arbash Meinel
Merge Lukas's extra tests, update for the new code. |
35 |
|
36 |
def test_different_case(self): |
|
37 |
wt = self.make_branch_and_tree('.') |
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
38 |
wt.commit(message='1', committer='Fero', rev_id=b'1') |
39 |
wt.commit(message='2', committer='Fero', rev_id=b'2') |
|
40 |
wt.commit(message='3', committer='FERO', rev_id=b'3') |
|
|
0.140.35
by John Arbash Meinel
Merge Lukas's extra tests, update for the new code. |
41 |
revs, committers = get_revisions_and_committers(wt.branch.repository, |
|
6973.12.10
by Jelmer Vernooij
Fix remaining tests. |
42 |
[b'1', b'2', b'3']) |
|
0.140.35
by John Arbash Meinel
Merge Lukas's extra tests, update for the new code. |
43 |
self.assertEqual({('Fero', ''): ('Fero', ''), |
44 |
('FERO', ''): ('Fero', ''), |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
45 |
}, committers) |
46 |
self.assertEquals([b'1', b'2', b'3'], sorted( |
|
47 |
[r.revision_id for r in revs])) |
|
|
0.150.4
by Lukáš Lalinský
Add email disambiguation to differentiate between empty emails + tests |
48 |
|
49 |
||
50 |
class TestCollapseByPerson(TestCase): |
|
51 |
||
52 |
def test_no_conflicts(self): |
|
|
0.140.35
by John Arbash Meinel
Merge Lukas's extra tests, update for the new code. |
53 |
revisions = [ |
54 |
Revision('1', {}, committer='Foo <foo@example.com>'), |
|
55 |
Revision('2', {}, committer='Bar <bar@example.com>'), |
|
56 |
Revision('3', {}, committer='Bar <bar@example.com>'), |
|
57 |
]
|
|
58 |
foo = ('Foo', 'foo@example.com') |
|
59 |
bar = ('Bar', 'bar@example.com') |
|
60 |
committers = {foo: foo, bar: bar} |
|
61 |
info = collapse_by_person(revisions, committers) |
|
|
0.150.4
by Lukáš Lalinský
Add email disambiguation to differentiate between empty emails + tests |
62 |
self.assertEquals(2, info[0][0]) |
|
0.140.35
by John Arbash Meinel
Merge Lukas's extra tests, update for the new code. |
63 |
self.assertEquals({'bar@example.com': 2}, info[0][2]) |
|
0.150.4
by Lukáš Lalinský
Add email disambiguation to differentiate between empty emails + tests |
64 |
self.assertEquals({'Bar': 2}, info[0][3]) |
65 |
||
66 |
def test_different_email(self): |
|
|
0.140.35
by John Arbash Meinel
Merge Lukas's extra tests, update for the new code. |
67 |
revisions = [ |
68 |
Revision('1', {}, committer='Foo <foo@example.com>'), |
|
69 |
Revision('2', {}, committer='Foo <bar@example.com>'), |
|
70 |
Revision('3', {}, committer='Foo <bar@example.com>'), |
|
71 |
]
|
|
72 |
foo = ('Foo', 'foo@example.com') |
|
73 |
bar = ('Foo', 'bar@example.com') |
|
74 |
committers = {foo: foo, bar: foo} |
|
75 |
info = collapse_by_person(revisions, committers) |
|
|
0.150.4
by Lukáš Lalinský
Add email disambiguation to differentiate between empty emails + tests |
76 |
self.assertEquals(3, info[0][0]) |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
77 |
self.assertEquals( |
78 |
{'foo@example.com': 1, 'bar@example.com': 2}, info[0][2]) |
|
|
0.150.4
by Lukáš Lalinský
Add email disambiguation to differentiate between empty emails + tests |
79 |
self.assertEquals({'Foo': 3}, info[0][3]) |
80 |
||
81 |
def test_different_name(self): |
|
|
0.140.35
by John Arbash Meinel
Merge Lukas's extra tests, update for the new code. |
82 |
revisions = [ |
83 |
Revision('1', {}, committer='Foo <foo@example.com>'), |
|
84 |
Revision('2', {}, committer='Bar <foo@example.com>'), |
|
85 |
Revision('3', {}, committer='Bar <foo@example.com>'), |
|
86 |
]
|
|
87 |
foo = ('Foo', 'foo@example.com') |
|
88 |
bar = ('Bar', 'foo@example.com') |
|
89 |
committers = {foo: foo, bar: foo} |
|
90 |
info = collapse_by_person(revisions, committers) |
|
|
0.150.4
by Lukáš Lalinský
Add email disambiguation to differentiate between empty emails + tests |
91 |
self.assertEquals(3, info[0][0]) |
|
0.140.35
by John Arbash Meinel
Merge Lukas's extra tests, update for the new code. |
92 |
self.assertEquals({'foo@example.com': 3}, info[0][2]) |
|
0.150.4
by Lukáš Lalinský
Add email disambiguation to differentiate between empty emails + tests |
93 |
self.assertEquals({'Foo': 1, 'Bar': 2}, info[0][3]) |
|
0.150.5
by Lukáš Lalinský
Ignore case when comparing author names |
94 |
|
95 |
def test_different_name_case(self): |
|
|
0.140.35
by John Arbash Meinel
Merge Lukas's extra tests, update for the new code. |
96 |
revisions = [ |
97 |
Revision('1', {}, committer='Foo <foo@example.com>'), |
|
98 |
Revision('2', {}, committer='Foo <foo@example.com>'), |
|
99 |
Revision('3', {}, committer='FOO <bar@example.com>'), |
|
100 |
]
|
|
101 |
foo = ('Foo', 'foo@example.com') |
|
102 |
FOO = ('FOO', 'bar@example.com') |
|
103 |
committers = {foo: foo, FOO: foo} |
|
104 |
info = collapse_by_person(revisions, committers) |
|
105 |
self.assertEquals(3, info[0][0]) |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
106 |
self.assertEquals( |
107 |
{'foo@example.com': 2, 'bar@example.com': 1}, info[0][2]) |
|
|
0.140.35
by John Arbash Meinel
Merge Lukas's extra tests, update for the new code. |
108 |
self.assertEquals({'Foo': 2, 'FOO': 1}, info[0][3]) |