bzr branch
http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar
|
0.140.49
by Jelmer Vernooij
use absolute_import everywhere. |
1 |
from __future__ import absolute_import |
2 |
||
|
6645.1.1
by Jelmer Vernooij
Bundle the stats plugin. |
3 |
from ...tests import TestCase, TestCaseWithTransport |
4 |
from ...revision import Revision |
|
5 |
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. |
6 |
|
7 |
||
8 |
class TestGetRevisionsAndCommitters(TestCaseWithTransport): |
|
|
0.150.4
by Lukáš Lalinský
Add email disambiguation to differentiate between empty emails + tests |
9 |
|
10 |
def test_simple(self): |
|
11 |
wt = self.make_branch_and_tree('.') |
|
12 |
wt.commit(message='1', committer='Fero <fero@example.com>', rev_id='1') |
|
13 |
wt.commit(message='2', committer='Fero <fero@example.com>', rev_id='2') |
|
14 |
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. |
15 |
wt.commit(message='4', committer='Jano <jano@example.com>', |
16 |
authors=['Vinco <vinco@example.com>'], rev_id='4') |
|
|
0.150.4
by Lukáš Lalinský
Add email disambiguation to differentiate between empty emails + tests |
17 |
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. |
18 |
revs, committers = get_revisions_and_committers(wt.branch.repository, |
19 |
['1', '2', '3', '4', '5']) |
|
20 |
fero = ('Fero', 'fero@example.com') |
|
21 |
jano = ('Jano', 'jano@example.com') |
|
22 |
vinco = ('Vinco', 'vinco@example.com') |
|
23 |
ferok = ('Ferko', 'fero@example.com') |
|
24 |
self.assertEqual({fero: fero, jano: jano, vinco:vinco, ferok: fero}, |
|
25 |
committers) |
|
|
0.150.4
by Lukáš Lalinský
Add email disambiguation to differentiate between empty emails + tests |
26 |
|
27 |
def test_empty_email(self): |
|
28 |
wt = self.make_branch_and_tree('.') |
|
29 |
wt.commit(message='1', committer='Fero', rev_id='1') |
|
30 |
wt.commit(message='2', committer='Fero', rev_id='2') |
|
31 |
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. |
32 |
revs, committers = get_revisions_and_committers(wt.branch.repository, |
33 |
['1', '2', '3']) |
|
34 |
self.assertEqual({('Fero', ''): ('Fero', ''), |
|
35 |
('Jano', ''): ('Jano', ''), |
|
36 |
}, committers) |
|
37 |
||
38 |
def test_different_case(self): |
|
39 |
wt = self.make_branch_and_tree('.') |
|
40 |
wt.commit(message='1', committer='Fero', rev_id='1') |
|
41 |
wt.commit(message='2', committer='Fero', rev_id='2') |
|
42 |
wt.commit(message='3', committer='FERO', rev_id='3') |
|
43 |
revs, committers = get_revisions_and_committers(wt.branch.repository, |
|
44 |
['1', '2', '3']) |
|
45 |
self.assertEqual({('Fero', ''): ('Fero', ''), |
|
46 |
('FERO', ''): ('Fero', ''), |
|
47 |
}, committers) |
|
|
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]) |
|
0.140.35
by John Arbash Meinel
Merge Lukas's extra tests, update for the new code. |
77 |
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 |
78 |
self.assertEquals({'Foo': 3}, info[0][3]) |
79 |
||
80 |
def test_different_name(self): |
|
|
0.140.35
by John Arbash Meinel
Merge Lukas's extra tests, update for the new code. |
81 |
revisions = [ |
82 |
Revision('1', {}, committer='Foo <foo@example.com>'), |
|
83 |
Revision('2', {}, committer='Bar <foo@example.com>'), |
|
84 |
Revision('3', {}, committer='Bar <foo@example.com>'), |
|
85 |
]
|
|
86 |
foo = ('Foo', 'foo@example.com') |
|
87 |
bar = ('Bar', 'foo@example.com') |
|
88 |
committers = {foo: foo, bar: foo} |
|
89 |
info = collapse_by_person(revisions, committers) |
|
|
0.150.4
by Lukáš Lalinský
Add email disambiguation to differentiate between empty emails + tests |
90 |
self.assertEquals(3, info[0][0]) |
|
0.140.35
by John Arbash Meinel
Merge Lukas's extra tests, update for the new code. |
91 |
self.assertEquals({'foo@example.com': 3}, info[0][2]) |
|
0.150.4
by Lukáš Lalinský
Add email disambiguation to differentiate between empty emails + tests |
92 |
self.assertEquals({'Foo': 1, 'Bar': 2}, info[0][3]) |
|
0.150.5
by Lukáš Lalinský
Ignore case when comparing author names |
93 |
|
94 |
def test_different_name_case(self): |
|
|
0.140.35
by John Arbash Meinel
Merge Lukas's extra tests, update for the new code. |
95 |
revisions = [ |
96 |
Revision('1', {}, committer='Foo <foo@example.com>'), |
|
97 |
Revision('2', {}, committer='Foo <foo@example.com>'), |
|
98 |
Revision('3', {}, committer='FOO <bar@example.com>'), |
|
99 |
]
|
|
100 |
foo = ('Foo', 'foo@example.com') |
|
101 |
FOO = ('FOO', 'bar@example.com') |
|
102 |
committers = {foo: foo, FOO: foo} |
|
103 |
info = collapse_by_person(revisions, committers) |
|
104 |
self.assertEquals(3, info[0][0]) |
|
105 |
self.assertEquals({'foo@example.com': 2, 'bar@example.com': 1}, info[0][2]) |
|
106 |
self.assertEquals({'Foo': 2, 'FOO': 1}, info[0][3]) |