Debian Codegraph @

tests/test-churn.t

raw
1 $ echo "[extensions]" >> $HGRCPATH
2 $ echo "churn=" >> $HGRCPATH
3
4 create test repository
5
6 $ hg init repo
7 $ cd repo
8 $ echo a > a
9 $ hg ci -Am adda -u user1 -d 6:00
10 adding a
11 $ echo b >> a
12 $ echo b > b
13 $ hg ci -m changeba -u user2 -d 9:00 a
14 $ hg ci -Am addb -u user2 -d 9:30
15 adding b
16 $ echo c >> a
17 $ echo c >> b
18 $ echo c > c
19 $ hg ci -m changeca -u user3 -d 12:00 a
20 $ hg ci -m changecb -u user3 -d 12:15 b
21 $ hg ci -Am addc -u user3 -d 12:30
22 adding c
23 $ mkdir -p d/e
24 $ echo abc > d/e/f1.txt
25 $ hg ci -Am "add d/e/f1.txt" -u user1 -d 12:45 d/e/f1.txt
26 $ mkdir -p d/g
27 $ echo def > d/g/f2.txt
28 $ hg ci -Am "add d/g/f2.txt" -u user1 -d 13:00 d/g/f2.txt
29
30
31 churn separate directories
32
33 $ cd d
34 $ hg churn e
35 user1 1 ***************************************************************
36
37 churn all
38
39 $ hg churn
40 user1 3 ***************************************************************
41 user3 3 ***************************************************************
42 user2 2 ******************************************
43
44 churn excluding one dir
45
46 $ hg churn -X e
47 user3 3 ***************************************************************
48 user1 2 ******************************************
49 user2 2 ******************************************
50
51 churn up to rev 2
52
53 $ hg churn -r :2
54 user2 2 ***************************************************************
55 user1 1 *******************************
56 $ cd ..
57
58 churn with aliases
59
60 $ cat > ../aliases <<EOF
61 > user1 alias1
62 > user3 alias3
63 > not-an-alias
64 > EOF
65
66 churn with .hgchurn
67
68 $ mv ../aliases .hgchurn
69 $ hg churn
70 skipping malformed alias: not-an-alias
71 alias1 3 **************************************************************
72 alias3 3 **************************************************************
73 user2 2 *****************************************
74 $ rm .hgchurn
75
76 churn with column specifier
77
78 $ COLUMNS=40 hg churn
79 user1 3 ***********************
80 user3 3 ***********************
81 user2 2 ***************
82
83 churn by hour
84
85 $ hg churn -f '%H' -s
86 06 1 ****************
87 09 2 *********************************
88 12 4 ******************************************************************
89 13 1 ****************
90
91
92 churn with separated added/removed lines
93
94 $ hg rm d/g/f2.txt
95 $ hg ci -Am "removed d/g/f2.txt" -u user1 -d 14:00 d/g/f2.txt
96 $ hg churn --diffstat
97 user1 +3/-1 ++++++++++++++++++++++++++++++++++++++++-------------
98 user3 +3/-0 ++++++++++++++++++++++++++++++++++++++++
99 user2 +2/-0 +++++++++++++++++++++++++++
100
101 churn --diffstat with color
102
103 $ hg --config extensions.color= churn --config color.mode=ansi \
104 > --diffstat --color=always
105 user1 +3/-1 \x1b[0;32m++++++++++++++++++++++++++++++++++++++++\x1b[0m\x1b[0;31m-------------\x1b[0m (esc)
106 user3 +3/-0 \x1b[0;32m++++++++++++++++++++++++++++++++++++++++\x1b[0m (esc)
107 user2 +2/-0 \x1b[0;32m+++++++++++++++++++++++++++\x1b[0m (esc)
108
109
110 changeset number churn
111
112 $ hg churn -c
113 user1 4 ***************************************************************
114 user3 3 ***********************************************
115 user2 2 *******************************
116
117 $ echo 'with space = no-space' >> ../aliases
118 $ echo a >> a
119 $ hg commit -m a -u 'with space' -d 15:00
120
121 churn with space in alias
122
123 $ hg churn --aliases ../aliases -r tip
124 no-space 1 ************************************************************
125
126 $ cd ..
127
128
129 Issue833: ZeroDivisionError
130
131 $ hg init issue-833
132 $ cd issue-833
133 $ touch foo
134 $ hg ci -Am foo
135 adding foo
136
137 this was failing with a ZeroDivisionError
138
139 $ hg churn
140 test 0
141 $ cd ..
142
143 Ignore trailing or leading spaces in emails
144
145 $ cd repo
146 $ touch bar
147 $ hg ci -Am'bar' -u 'user4 <[email protected]>'
148 adding bar
149 $ touch foo
150 $ hg ci -Am'foo' -u 'user4 < [email protected] >'
151 adding foo
152 $ hg log -l2 --template '[{author|email}]\n'
153 [ [email protected] ]
154 [[email protected]]
155 $ hg churn -c
156 user1 4 *********************************************************
157 user3 3 ******************************************
158 user2 2 ****************************
159 [email protected] 2 ****************************
160 with space 1 **************
161
162 Test multibyte sequences in names
163
164 $ echo bar >> bar
165 $ hg --encoding utf-8 ci -m'changed bar' -u 'El NiƱo <[email protected]>'
166 $ hg --encoding utf-8 churn -ct '{author|person}'
167 user1 4 **********************************************************
168 user3 3 *******************************************
169 user2 2 *****************************
170 user4 2 *****************************
171 El Ni\xc3\xb1o 1 ************** (esc)
172 with space 1 **************
173
174 Test --template argument, with backwards compatibility
175
176 $ hg churn -t '{author|user}'
177 user1 4 ***************************************************************
178 user3 3 ***********************************************
179 user2 2 *******************************
180 nino 1 ***************
181 with 1 ***************
182 0
183 user4 0
184 $ hg churn -T '{author|user}'
185 user1 4 ***************************************************************
186 user3 3 ***********************************************
187 user2 2 *******************************
188 nino 1 ***************
189 with 1 ***************
190 0
191 user4 0
192 $ hg churn -t 'alltogether'
193 alltogether 11 *********************************************************
194 $ hg churn -T 'alltogether'
195 alltogether 11 *********************************************************
196
197 $ cd ..
198
199 count lines that look like headings but are not
200
201 $ hg init not-headers
202 $ cd not-headers
203 $ cat > a <<EOF
204 > diff
205 > @@ -195,3 +195,21 @@
206 > -- a/tests/test-churn.t
207 > ++ b/tests/test-churn.t
208 > EOF
209 $ hg ci -Am adda -u user1
210 adding a
211 $ hg churn --diffstat
212 user1 +4/-0 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
213 $ hg rm a
214 $ hg ci -Am removea -u user1
215 $ hg churn --diffstat
216 user1 +4/-4 +++++++++++++++++++++++++++---------------------------