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