summaryrefslogtreecommitdiff
path: root/tests/test-churn.t
blob: b744d640b7fe2225cad43b97957b377952dcdcdd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
  $ echo "[extensions]" >> $HGRCPATH
  $ echo "churn=" >> $HGRCPATH

create test repository

  $ hg init repo
  $ cd repo
  $ echo a > a
  $ hg ci -Am adda -u user1 -d 6:00
  adding a
  $ echo b >> a
  $ echo b > b
  $ hg ci -m changeba -u user2 -d 9:00 a
  $ hg ci -Am addb -u user2 -d 9:30
  adding b
  $ echo c >> a
  $ echo c >> b
  $ echo c > c
  $ hg ci -m changeca -u user3 -d 12:00 a
  $ hg ci -m changecb -u user3 -d 12:15 b
  $ hg ci -Am addc -u user3 -d 12:30
  adding c
  $ mkdir -p d/e
  $ echo abc > d/e/f1.txt
  $ hg ci -Am "add d/e/f1.txt" -u user1 -d 12:45 d/e/f1.txt
  $ mkdir -p d/g
  $ echo def > d/g/f2.txt
  $ hg ci -Am "add d/g/f2.txt" -u user1 -d 13:00 d/g/f2.txt


churn separate directories

  $ cd d
  $ hg churn e
  user1      1 ***************************************************************

churn all

  $ hg churn
  user3      3 ***************************************************************
  user1      3 ***************************************************************
  user2      2 ******************************************

churn excluding one dir

  $ hg churn -X e
  user3      3 ***************************************************************
  user2      2 ******************************************
  user1      2 ******************************************

churn up to rev 2

  $ hg churn -r :2
  user2      2 ***************************************************************
  user1      1 ********************************
  $ cd ..

churn with aliases

  $ cat > ../aliases <<EOF
  > user1 alias1
  > user3 alias3
  > not-an-alias
  > EOF

churn with .hgchurn

  $ mv ../aliases .hgchurn
  $ hg churn
  skipping malformed alias: not-an-alias
  alias3      3 **************************************************************
  alias1      3 **************************************************************
  user2       2 *****************************************
  $ rm .hgchurn

churn with column specifier

  $ COLUMNS=40 hg churn
  user3      3 ***********************
  user1      3 ***********************
  user2      2 ***************

churn by hour

  $ hg churn -f '%H' -s
  06      1 *****************
  09      2 *********************************
  12      4 ******************************************************************
  13      1 *****************


churn with separated added/removed lines

  $ hg rm d/g/f2.txt
  $ hg ci -Am "removed d/g/f2.txt" -u user1 -d 14:00 d/g/f2.txt
  $ hg churn --diffstat
  user1           +3/-1 +++++++++++++++++++++++++++++++++++++++++--------------
  user3           +3/-0 +++++++++++++++++++++++++++++++++++++++++
  user2           +2/-0 +++++++++++++++++++++++++++

churn --diffstat with color

  $ hg --config extensions.color= churn --config color.mode=ansi \
  >     --diffstat --color=always
  user1           +3/-1 \x1b[0;32m+++++++++++++++++++++++++++++++++++++++++\x1b[0m\x1b[0;31m--------------\x1b[0m (esc)
  user3           +3/-0 \x1b[0;32m+++++++++++++++++++++++++++++++++++++++++\x1b[0m (esc)
  user2           +2/-0 \x1b[0;32m+++++++++++++++++++++++++++\x1b[0m (esc)


changeset number churn

  $ hg churn -c
  user1      4 ***************************************************************
  user3      3 ***********************************************
  user2      2 ********************************

  $ echo 'with space = no-space' >> ../aliases
  $ echo a >> a
  $ hg commit -m a -u 'with space' -d 15:00

churn with space in alias

  $ hg churn --aliases ../aliases -r tip
  no-space      1 ************************************************************

  $ cd ..


Issue833: ZeroDivisionError

  $ hg init issue-833
  $ cd issue-833
  $ touch foo
  $ hg ci -Am foo
  adding foo

this was failing with a ZeroDivisionError

  $ hg churn
  test      0 
  $ cd ..

Ignore trailing or leading spaces in emails

  $ cd repo
  $ touch bar
  $ hg ci -Am'bar' -u 'user4 <user4@x.com>'
  adding bar
  $ touch foo
  $ hg ci -Am'foo' -u 'user4 < user4@x.com >'
  adding foo
  $ hg log -l2 --template '[{author|email}]\n'
  [ user4@x.com ]
  [user4@x.com]
  $ hg churn -c
  user1            4 *********************************************************
  user3            3 *******************************************
  user4@x.com      2 *****************************
  user2            2 *****************************
  with space       1 **************

  $ cd ..