Debian Codegraph @

tests/test-mailmap.t

raw
1 Create a repo and add some commits
2
3 $ hg init mm
4 $ cd mm
5 $ echo "Test content" > testfile1
6 $ hg add testfile1
7 $ hg commit -m "First commit" -u "Proper <[email protected]>"
8 $ echo "Test content 2" > testfile2
9 $ hg add testfile2
10 $ hg commit -m "Second commit" -u "Commit Name 2 <[email protected]>"
11 $ echo "Test content 3" > testfile3
12 $ hg add testfile3
13 $ hg commit -m "Third commit" -u "Commit Name 3 <[email protected]>"
14 $ echo "Test content 4" > testfile4
15 $ hg add testfile4
16 $ hg commit -m "Fourth commit" -u "Commit Name 4 <[email protected]>"
17
18 Add a .mailmap file with each possible entry type plus comments
19 $ cat > .mailmap << EOF
20 > # Comment shouldn't break anything
21 > <[email protected]> <[email protected]> # Should update email only
22 > Proper Name 2 <[email protected]> # Should update name only
23 > Proper Name 3 <[email protected]> <[email protected]> # Should update name, email due to email
24 > Proper Name 4 <[email protected]> Commit Name 4 <[email protected]> # Should update name, email due to name, email
25 > EOF
26 $ hg add .mailmap
27 $ hg commit -m "Add mailmap file" -u "Testuser <[email protected]>"
28
29 Output of commits should be normal without filter
30 $ hg log -T "{author}\n" -r "all()"
31 Proper <[email protected]>
32 Commit Name 2 <[email protected]>
33 Commit Name 3 <[email protected]>
34 Commit Name 4 <[email protected]>
35 Testuser <[email protected]>
36
37 Output of commits with filter shows their mailmap values
38 $ hg log -T "{mailmap(author)}\n" -r "all()"
39 Proper <[email protected]>
40 Proper Name 2 <[email protected]>
41 Proper Name 3 <[email protected]>
42 Proper Name 4 <[email protected]>
43 Testuser <[email protected]>
44
45 Add new mailmap entry for testuser
46 $ cat >> .mailmap << EOF
47 > <[email protected]> <[email protected]>
48 > EOF
49
50 Output of commits with filter shows their updated mailmap values
51 $ hg log -T "{mailmap(author)}\n" -r "all()"
52 Proper <[email protected]>
53 Proper Name 2 <[email protected]>
54 Proper Name 3 <[email protected]>
55 Proper Name 4 <[email protected]>
56 Testuser <[email protected]>
57
58 A commit with improperly formatted user field should not break the filter
59 $ echo "some more test content" > testfile1
60 $ hg commit -m "Commit with improper user field" -u "Improper user"
61 $ hg log -T "{mailmap(author)}\n" -r "all()"
62 Proper <[email protected]>
63 Proper Name 2 <[email protected]>
64 Proper Name 3 <[email protected]>
65 Proper Name 4 <[email protected]>
66 Testuser <[email protected]>
67 Improper user
68
69 No TypeError beacause of invalid input
70
71 $ hg log -T '{mailmap(termwidth)}\n' -r0
72 80