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