Show More
@@ -1,197 +1,198 b'' | |||||
1 | # churn.py - create a graph of revisions count grouped by template |
|
1 | # churn.py - create a graph of revisions count grouped by template | |
2 | # |
|
2 | # | |
3 | # Copyright 2006 Josef "Jeff" Sipek <jeffpc@josefsipek.net> |
|
3 | # Copyright 2006 Josef "Jeff" Sipek <jeffpc@josefsipek.net> | |
4 | # Copyright 2008 Alexander Solovyov <piranha@piranha.org.ua> |
|
4 | # Copyright 2008 Alexander Solovyov <piranha@piranha.org.ua> | |
5 | # |
|
5 | # | |
6 | # This software may be used and distributed according to the terms of the |
|
6 | # This software may be used and distributed according to the terms of the | |
7 | # GNU General Public License version 2 or any later version. |
|
7 | # GNU General Public License version 2 or any later version. | |
8 |
|
8 | |||
9 | '''command to display statistics about repository history''' |
|
9 | '''command to display statistics about repository history''' | |
10 |
|
10 | |||
11 | from mercurial.i18n import _ |
|
11 | from mercurial.i18n import _ | |
12 | from mercurial import patch, cmdutil, util, templater, commands |
|
12 | from mercurial import patch, cmdutil, util, templater, commands | |
13 | import os |
|
13 | import os | |
14 | import time, datetime |
|
14 | import time, datetime | |
15 |
|
15 | |||
16 | def maketemplater(ui, repo, tmpl): |
|
16 | def maketemplater(ui, repo, tmpl): | |
17 | tmpl = templater.parsestring(tmpl, quoted=False) |
|
17 | tmpl = templater.parsestring(tmpl, quoted=False) | |
18 | try: |
|
18 | try: | |
19 | t = cmdutil.changeset_templater(ui, repo, False, None, None, False) |
|
19 | t = cmdutil.changeset_templater(ui, repo, False, None, None, False) | |
20 | except SyntaxError, inst: |
|
20 | except SyntaxError, inst: | |
21 | raise util.Abort(inst.args[0]) |
|
21 | raise util.Abort(inst.args[0]) | |
22 | t.use_template(tmpl) |
|
22 | t.use_template(tmpl) | |
23 | return t |
|
23 | return t | |
24 |
|
24 | |||
25 | def changedlines(ui, repo, ctx1, ctx2, fns): |
|
25 | def changedlines(ui, repo, ctx1, ctx2, fns): | |
26 | added, removed = 0, 0 |
|
26 | added, removed = 0, 0 | |
27 | fmatch = cmdutil.matchfiles(repo, fns) |
|
27 | fmatch = cmdutil.matchfiles(repo, fns) | |
28 | diff = ''.join(patch.diff(repo, ctx1.node(), ctx2.node(), fmatch)) |
|
28 | diff = ''.join(patch.diff(repo, ctx1.node(), ctx2.node(), fmatch)) | |
29 | for l in diff.split('\n'): |
|
29 | for l in diff.split('\n'): | |
30 | if l.startswith("+") and not l.startswith("+++ "): |
|
30 | if l.startswith("+") and not l.startswith("+++ "): | |
31 | added += 1 |
|
31 | added += 1 | |
32 | elif l.startswith("-") and not l.startswith("--- "): |
|
32 | elif l.startswith("-") and not l.startswith("--- "): | |
33 | removed += 1 |
|
33 | removed += 1 | |
34 | return (added, removed) |
|
34 | return (added, removed) | |
35 |
|
35 | |||
36 | def countrate(ui, repo, amap, *pats, **opts): |
|
36 | def countrate(ui, repo, amap, *pats, **opts): | |
37 | """Calculate stats""" |
|
37 | """Calculate stats""" | |
38 | if opts.get('dateformat'): |
|
38 | if opts.get('dateformat'): | |
39 | def getkey(ctx): |
|
39 | def getkey(ctx): | |
40 | t, tz = ctx.date() |
|
40 | t, tz = ctx.date() | |
41 | date = datetime.datetime(*time.gmtime(float(t) - tz)[:6]) |
|
41 | date = datetime.datetime(*time.gmtime(float(t) - tz)[:6]) | |
42 | return date.strftime(opts['dateformat']) |
|
42 | return date.strftime(opts['dateformat']) | |
43 | else: |
|
43 | else: | |
44 | tmpl = opts.get('template', '{author|email}') |
|
44 | tmpl = opts.get('template', '{author|email}') | |
45 | tmpl = maketemplater(ui, repo, tmpl) |
|
45 | tmpl = maketemplater(ui, repo, tmpl) | |
46 | def getkey(ctx): |
|
46 | def getkey(ctx): | |
47 | ui.pushbuffer() |
|
47 | ui.pushbuffer() | |
48 | tmpl.show(ctx) |
|
48 | tmpl.show(ctx) | |
49 | return ui.popbuffer() |
|
49 | return ui.popbuffer() | |
50 |
|
50 | |||
51 | state = {'count': 0} |
|
51 | state = {'count': 0} | |
52 | rate = {} |
|
52 | rate = {} | |
53 | df = False |
|
53 | df = False | |
54 | if opts.get('date'): |
|
54 | if opts.get('date'): | |
55 | df = util.matchdate(opts['date']) |
|
55 | df = util.matchdate(opts['date']) | |
56 |
|
56 | |||
57 | m = cmdutil.match(repo, pats, opts) |
|
57 | m = cmdutil.match(repo, pats, opts) | |
58 | def prep(ctx, fns): |
|
58 | def prep(ctx, fns): | |
59 | rev = ctx.rev() |
|
59 | rev = ctx.rev() | |
60 | if df and not df(ctx.date()[0]): # doesn't match date format |
|
60 | if df and not df(ctx.date()[0]): # doesn't match date format | |
61 | return |
|
61 | return | |
62 |
|
62 | |||
63 | key = getkey(ctx) |
|
63 | key = getkey(ctx) | |
64 | key = amap.get(key, key) # alias remap |
|
64 | key = amap.get(key, key) # alias remap | |
|
65 | key = key.strip() # ignore leading and trailing spaces | |||
65 | if opts.get('changesets'): |
|
66 | if opts.get('changesets'): | |
66 | rate[key] = (rate.get(key, (0,))[0] + 1, 0) |
|
67 | rate[key] = (rate.get(key, (0,))[0] + 1, 0) | |
67 | else: |
|
68 | else: | |
68 | parents = ctx.parents() |
|
69 | parents = ctx.parents() | |
69 | if len(parents) > 1: |
|
70 | if len(parents) > 1: | |
70 | ui.note(_('Revision %d is a merge, ignoring...\n') % (rev,)) |
|
71 | ui.note(_('Revision %d is a merge, ignoring...\n') % (rev,)) | |
71 | return |
|
72 | return | |
72 |
|
73 | |||
73 | ctx1 = parents[0] |
|
74 | ctx1 = parents[0] | |
74 | lines = changedlines(ui, repo, ctx1, ctx, fns) |
|
75 | lines = changedlines(ui, repo, ctx1, ctx, fns) | |
75 | rate[key] = [r + l for r, l in zip(rate.get(key, (0, 0)), lines)] |
|
76 | rate[key] = [r + l for r, l in zip(rate.get(key, (0, 0)), lines)] | |
76 |
|
77 | |||
77 | state['count'] += 1 |
|
78 | state['count'] += 1 | |
78 | ui.progress(_('analyzing'), state['count'], total=len(repo)) |
|
79 | ui.progress(_('analyzing'), state['count'], total=len(repo)) | |
79 |
|
80 | |||
80 | for ctx in cmdutil.walkchangerevs(repo, m, opts, prep): |
|
81 | for ctx in cmdutil.walkchangerevs(repo, m, opts, prep): | |
81 | continue |
|
82 | continue | |
82 |
|
83 | |||
83 | ui.progress(_('analyzing'), None) |
|
84 | ui.progress(_('analyzing'), None) | |
84 |
|
85 | |||
85 | return rate |
|
86 | return rate | |
86 |
|
87 | |||
87 |
|
88 | |||
88 | def churn(ui, repo, *pats, **opts): |
|
89 | def churn(ui, repo, *pats, **opts): | |
89 | '''histogram of changes to the repository |
|
90 | '''histogram of changes to the repository | |
90 |
|
91 | |||
91 | This command will display a histogram representing the number |
|
92 | This command will display a histogram representing the number | |
92 | of changed lines or revisions, grouped according to the given |
|
93 | of changed lines or revisions, grouped according to the given | |
93 | template. The default template will group changes by author. |
|
94 | template. The default template will group changes by author. | |
94 | The --dateformat option may be used to group the results by |
|
95 | The --dateformat option may be used to group the results by | |
95 | date instead. |
|
96 | date instead. | |
96 |
|
97 | |||
97 | Statistics are based on the number of changed lines, or |
|
98 | Statistics are based on the number of changed lines, or | |
98 | alternatively the number of matching revisions if the |
|
99 | alternatively the number of matching revisions if the | |
99 | --changesets option is specified. |
|
100 | --changesets option is specified. | |
100 |
|
101 | |||
101 | Examples:: |
|
102 | Examples:: | |
102 |
|
103 | |||
103 | # display count of changed lines for every committer |
|
104 | # display count of changed lines for every committer | |
104 | hg churn -t '{author|email}' |
|
105 | hg churn -t '{author|email}' | |
105 |
|
106 | |||
106 | # display daily activity graph |
|
107 | # display daily activity graph | |
107 | hg churn -f '%H' -s -c |
|
108 | hg churn -f '%H' -s -c | |
108 |
|
109 | |||
109 | # display activity of developers by month |
|
110 | # display activity of developers by month | |
110 | hg churn -f '%Y-%m' -s -c |
|
111 | hg churn -f '%Y-%m' -s -c | |
111 |
|
112 | |||
112 | # display count of lines changed in every year |
|
113 | # display count of lines changed in every year | |
113 | hg churn -f '%Y' -s |
|
114 | hg churn -f '%Y' -s | |
114 |
|
115 | |||
115 | It is possible to map alternate email addresses to a main address |
|
116 | It is possible to map alternate email addresses to a main address | |
116 | by providing a file using the following format:: |
|
117 | by providing a file using the following format:: | |
117 |
|
118 | |||
118 | <alias email> = <actual email> |
|
119 | <alias email> = <actual email> | |
119 |
|
120 | |||
120 | Such a file may be specified with the --aliases option, otherwise |
|
121 | Such a file may be specified with the --aliases option, otherwise | |
121 | a .hgchurn file will be looked for in the working directory root. |
|
122 | a .hgchurn file will be looked for in the working directory root. | |
122 | ''' |
|
123 | ''' | |
123 | def pad(s, l): |
|
124 | def pad(s, l): | |
124 | return (s + " " * l)[:l] |
|
125 | return (s + " " * l)[:l] | |
125 |
|
126 | |||
126 | amap = {} |
|
127 | amap = {} | |
127 | aliases = opts.get('aliases') |
|
128 | aliases = opts.get('aliases') | |
128 | if not aliases and os.path.exists(repo.wjoin('.hgchurn')): |
|
129 | if not aliases and os.path.exists(repo.wjoin('.hgchurn')): | |
129 | aliases = repo.wjoin('.hgchurn') |
|
130 | aliases = repo.wjoin('.hgchurn') | |
130 | if aliases: |
|
131 | if aliases: | |
131 | for l in open(aliases, "r"): |
|
132 | for l in open(aliases, "r"): | |
132 | try: |
|
133 | try: | |
133 | alias, actual = l.split('=' in l and '=' or None, 1) |
|
134 | alias, actual = l.split('=' in l and '=' or None, 1) | |
134 | amap[alias.strip()] = actual.strip() |
|
135 | amap[alias.strip()] = actual.strip() | |
135 | except ValueError: |
|
136 | except ValueError: | |
136 | l = l.strip() |
|
137 | l = l.strip() | |
137 | if l: |
|
138 | if l: | |
138 | ui.warn(_("skipping malformed alias: %s\n" % l)) |
|
139 | ui.warn(_("skipping malformed alias: %s\n" % l)) | |
139 | continue |
|
140 | continue | |
140 |
|
141 | |||
141 | rate = countrate(ui, repo, amap, *pats, **opts).items() |
|
142 | rate = countrate(ui, repo, amap, *pats, **opts).items() | |
142 | if not rate: |
|
143 | if not rate: | |
143 | return |
|
144 | return | |
144 |
|
145 | |||
145 | sortkey = ((not opts.get('sort')) and (lambda x: -sum(x[1])) or None) |
|
146 | sortkey = ((not opts.get('sort')) and (lambda x: -sum(x[1])) or None) | |
146 | rate.sort(key=sortkey) |
|
147 | rate.sort(key=sortkey) | |
147 |
|
148 | |||
148 | # Be careful not to have a zero maxcount (issue833) |
|
149 | # Be careful not to have a zero maxcount (issue833) | |
149 | maxcount = float(max(sum(v) for k, v in rate)) or 1.0 |
|
150 | maxcount = float(max(sum(v) for k, v in rate)) or 1.0 | |
150 | maxname = max(len(k) for k, v in rate) |
|
151 | maxname = max(len(k) for k, v in rate) | |
151 |
|
152 | |||
152 | ttywidth = ui.termwidth() |
|
153 | ttywidth = ui.termwidth() | |
153 | ui.debug("assuming %i character terminal\n" % ttywidth) |
|
154 | ui.debug("assuming %i character terminal\n" % ttywidth) | |
154 | width = ttywidth - maxname - 2 - 2 - 2 |
|
155 | width = ttywidth - maxname - 2 - 2 - 2 | |
155 |
|
156 | |||
156 | if opts.get('diffstat'): |
|
157 | if opts.get('diffstat'): | |
157 | width -= 15 |
|
158 | width -= 15 | |
158 | def format(name, diffstat): |
|
159 | def format(name, diffstat): | |
159 | added, removed = diffstat |
|
160 | added, removed = diffstat | |
160 | return "%s %15s %s%s\n" % (pad(name, maxname), |
|
161 | return "%s %15s %s%s\n" % (pad(name, maxname), | |
161 | '+%d/-%d' % (added, removed), |
|
162 | '+%d/-%d' % (added, removed), | |
162 | ui.label('+' * charnum(added), |
|
163 | ui.label('+' * charnum(added), | |
163 | 'diffstat.inserted'), |
|
164 | 'diffstat.inserted'), | |
164 | ui.label('-' * charnum(removed), |
|
165 | ui.label('-' * charnum(removed), | |
165 | 'diffstat.deleted')) |
|
166 | 'diffstat.deleted')) | |
166 | else: |
|
167 | else: | |
167 | width -= 6 |
|
168 | width -= 6 | |
168 | def format(name, count): |
|
169 | def format(name, count): | |
169 | return "%s %6d %s\n" % (pad(name, maxname), sum(count), |
|
170 | return "%s %6d %s\n" % (pad(name, maxname), sum(count), | |
170 | '*' * charnum(sum(count))) |
|
171 | '*' * charnum(sum(count))) | |
171 |
|
172 | |||
172 | def charnum(count): |
|
173 | def charnum(count): | |
173 | return int(round(count * width / maxcount)) |
|
174 | return int(round(count * width / maxcount)) | |
174 |
|
175 | |||
175 | for name, count in rate: |
|
176 | for name, count in rate: | |
176 | ui.write(format(name, count)) |
|
177 | ui.write(format(name, count)) | |
177 |
|
178 | |||
178 |
|
179 | |||
179 | cmdtable = { |
|
180 | cmdtable = { | |
180 | "churn": |
|
181 | "churn": | |
181 | (churn, |
|
182 | (churn, | |
182 | [('r', 'rev', [], |
|
183 | [('r', 'rev', [], | |
183 | _('count rate for the specified revision or range'), _('REV')), |
|
184 | _('count rate for the specified revision or range'), _('REV')), | |
184 | ('d', 'date', '', |
|
185 | ('d', 'date', '', | |
185 | _('count rate for revisions matching date spec'), _('DATE')), |
|
186 | _('count rate for revisions matching date spec'), _('DATE')), | |
186 | ('t', 'template', '{author|email}', |
|
187 | ('t', 'template', '{author|email}', | |
187 | _('template to group changesets'), _('TEMPLATE')), |
|
188 | _('template to group changesets'), _('TEMPLATE')), | |
188 | ('f', 'dateformat', '', |
|
189 | ('f', 'dateformat', '', | |
189 | _('strftime-compatible format for grouping by date'), _('FORMAT')), |
|
190 | _('strftime-compatible format for grouping by date'), _('FORMAT')), | |
190 | ('c', 'changesets', False, _('count rate by number of changesets')), |
|
191 | ('c', 'changesets', False, _('count rate by number of changesets')), | |
191 | ('s', 'sort', False, _('sort by key (default: sort by count)')), |
|
192 | ('s', 'sort', False, _('sort by key (default: sort by count)')), | |
192 | ('', 'diffstat', False, _('display added/removed lines separately')), |
|
193 | ('', 'diffstat', False, _('display added/removed lines separately')), | |
193 | ('', 'aliases', '', |
|
194 | ('', 'aliases', '', | |
194 | _('file with email aliases'), _('FILE')), |
|
195 | _('file with email aliases'), _('FILE')), | |
195 | ] + commands.walkopts, |
|
196 | ] + commands.walkopts, | |
196 | _("hg churn [-d DATE] [-r REV] [--aliases FILE] [FILE]")), |
|
197 | _("hg churn [-d DATE] [-r REV] [--aliases FILE] [FILE]")), | |
197 | } |
|
198 | } |
@@ -1,141 +1,160 b'' | |||||
1 | $ echo "[extensions]" >> $HGRCPATH |
|
1 | $ echo "[extensions]" >> $HGRCPATH | |
2 | $ echo "churn=" >> $HGRCPATH |
|
2 | $ echo "churn=" >> $HGRCPATH | |
3 |
|
3 | |||
4 | create test repository |
|
4 | create test repository | |
5 |
|
5 | |||
6 | $ hg init repo |
|
6 | $ hg init repo | |
7 | $ cd repo |
|
7 | $ cd repo | |
8 | $ echo a > a |
|
8 | $ echo a > a | |
9 | $ hg ci -Am adda -u user1 -d 6:00 |
|
9 | $ hg ci -Am adda -u user1 -d 6:00 | |
10 | adding a |
|
10 | adding a | |
11 | $ echo b >> a |
|
11 | $ echo b >> a | |
12 | $ echo b > b |
|
12 | $ echo b > b | |
13 | $ hg ci -m changeba -u user2 -d 9:00 a |
|
13 | $ hg ci -m changeba -u user2 -d 9:00 a | |
14 | $ hg ci -Am addb -u user2 -d 9:30 |
|
14 | $ hg ci -Am addb -u user2 -d 9:30 | |
15 | adding b |
|
15 | adding b | |
16 | $ echo c >> a |
|
16 | $ echo c >> a | |
17 | $ echo c >> b |
|
17 | $ echo c >> b | |
18 | $ echo c > c |
|
18 | $ echo c > c | |
19 | $ hg ci -m changeca -u user3 -d 12:00 a |
|
19 | $ hg ci -m changeca -u user3 -d 12:00 a | |
20 | $ hg ci -m changecb -u user3 -d 12:15 b |
|
20 | $ hg ci -m changecb -u user3 -d 12:15 b | |
21 | $ hg ci -Am addc -u user3 -d 12:30 |
|
21 | $ hg ci -Am addc -u user3 -d 12:30 | |
22 | adding c |
|
22 | adding c | |
23 | $ mkdir -p d/e |
|
23 | $ mkdir -p d/e | |
24 | $ echo abc > d/e/f1.txt |
|
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 |
|
25 | $ hg ci -Am "add d/e/f1.txt" -u user1 -d 12:45 d/e/f1.txt | |
26 | $ mkdir -p d/g |
|
26 | $ mkdir -p d/g | |
27 | $ echo def > d/g/f2.txt |
|
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 |
|
28 | $ hg ci -Am "add d/g/f2.txt" -u user1 -d 13:00 d/g/f2.txt | |
29 |
|
29 | |||
30 |
|
30 | |||
31 | churn separate directories |
|
31 | churn separate directories | |
32 |
|
32 | |||
33 | $ cd d |
|
33 | $ cd d | |
34 | $ hg churn e |
|
34 | $ hg churn e | |
35 | user1 1 *************************************************************** |
|
35 | user1 1 *************************************************************** | |
36 |
|
36 | |||
37 | churn all |
|
37 | churn all | |
38 |
|
38 | |||
39 | $ hg churn |
|
39 | $ hg churn | |
40 | user3 3 *************************************************************** |
|
40 | user3 3 *************************************************************** | |
41 | user1 3 *************************************************************** |
|
41 | user1 3 *************************************************************** | |
42 | user2 2 ****************************************** |
|
42 | user2 2 ****************************************** | |
43 |
|
43 | |||
44 | churn excluding one dir |
|
44 | churn excluding one dir | |
45 |
|
45 | |||
46 | $ hg churn -X e |
|
46 | $ hg churn -X e | |
47 | user3 3 *************************************************************** |
|
47 | user3 3 *************************************************************** | |
48 | user2 2 ****************************************** |
|
48 | user2 2 ****************************************** | |
49 | user1 2 ****************************************** |
|
49 | user1 2 ****************************************** | |
50 |
|
50 | |||
51 | churn up to rev 2 |
|
51 | churn up to rev 2 | |
52 |
|
52 | |||
53 | $ hg churn -r :2 |
|
53 | $ hg churn -r :2 | |
54 | user2 2 *************************************************************** |
|
54 | user2 2 *************************************************************** | |
55 | user1 1 ******************************** |
|
55 | user1 1 ******************************** | |
56 | $ cd .. |
|
56 | $ cd .. | |
57 |
|
57 | |||
58 | churn with aliases |
|
58 | churn with aliases | |
59 |
|
59 | |||
60 | $ cat > ../aliases <<EOF |
|
60 | $ cat > ../aliases <<EOF | |
61 | > user1 alias1 |
|
61 | > user1 alias1 | |
62 | > user3 alias3 |
|
62 | > user3 alias3 | |
63 | > not-an-alias |
|
63 | > not-an-alias | |
64 | > EOF |
|
64 | > EOF | |
65 |
|
65 | |||
66 | churn with .hgchurn |
|
66 | churn with .hgchurn | |
67 |
|
67 | |||
68 | $ mv ../aliases .hgchurn |
|
68 | $ mv ../aliases .hgchurn | |
69 | $ hg churn |
|
69 | $ hg churn | |
70 | skipping malformed alias: not-an-alias |
|
70 | skipping malformed alias: not-an-alias | |
71 | alias3 3 ************************************************************** |
|
71 | alias3 3 ************************************************************** | |
72 | alias1 3 ************************************************************** |
|
72 | alias1 3 ************************************************************** | |
73 | user2 2 ***************************************** |
|
73 | user2 2 ***************************************** | |
74 | $ rm .hgchurn |
|
74 | $ rm .hgchurn | |
75 |
|
75 | |||
76 | churn with column specifier |
|
76 | churn with column specifier | |
77 |
|
77 | |||
78 | $ COLUMNS=40 hg churn |
|
78 | $ COLUMNS=40 hg churn | |
79 | user3 3 *********************** |
|
79 | user3 3 *********************** | |
80 | user1 3 *********************** |
|
80 | user1 3 *********************** | |
81 | user2 2 *************** |
|
81 | user2 2 *************** | |
82 |
|
82 | |||
83 | churn by hour |
|
83 | churn by hour | |
84 |
|
84 | |||
85 | $ hg churn -f '%H' -s |
|
85 | $ hg churn -f '%H' -s | |
86 | 06 1 ***************** |
|
86 | 06 1 ***************** | |
87 | 09 2 ********************************* |
|
87 | 09 2 ********************************* | |
88 | 12 4 ****************************************************************** |
|
88 | 12 4 ****************************************************************** | |
89 | 13 1 ***************** |
|
89 | 13 1 ***************** | |
90 |
|
90 | |||
91 |
|
91 | |||
92 | churn with separated added/removed lines |
|
92 | churn with separated added/removed lines | |
93 |
|
93 | |||
94 | $ hg rm d/g/f2.txt |
|
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 |
|
95 | $ hg ci -Am "removed d/g/f2.txt" -u user1 -d 14:00 d/g/f2.txt | |
96 | $ hg churn --diffstat |
|
96 | $ hg churn --diffstat | |
97 | user1 +3/-1 +++++++++++++++++++++++++++++++++++++++++-------------- |
|
97 | user1 +3/-1 +++++++++++++++++++++++++++++++++++++++++-------------- | |
98 | user3 +3/-0 +++++++++++++++++++++++++++++++++++++++++ |
|
98 | user3 +3/-0 +++++++++++++++++++++++++++++++++++++++++ | |
99 | user2 +2/-0 +++++++++++++++++++++++++++ |
|
99 | user2 +2/-0 +++++++++++++++++++++++++++ | |
100 |
|
100 | |||
101 | churn --diffstat with color |
|
101 | churn --diffstat with color | |
102 |
|
102 | |||
103 | $ hg --config extensions.color= churn --config color.mode=ansi \ |
|
103 | $ hg --config extensions.color= churn --config color.mode=ansi \ | |
104 | > --diffstat --color=always |
|
104 | > --diffstat --color=always | |
105 | user1 +3/-1 \x1b[0;32m+++++++++++++++++++++++++++++++++++++++++\x1b[0m\x1b[0;31m--------------\x1b[0m (esc) |
|
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) |
|
106 | user3 +3/-0 \x1b[0;32m+++++++++++++++++++++++++++++++++++++++++\x1b[0m (esc) | |
107 | user2 +2/-0 \x1b[0;32m+++++++++++++++++++++++++++\x1b[0m (esc) |
|
107 | user2 +2/-0 \x1b[0;32m+++++++++++++++++++++++++++\x1b[0m (esc) | |
108 |
|
108 | |||
109 |
|
109 | |||
110 | changeset number churn |
|
110 | changeset number churn | |
111 |
|
111 | |||
112 | $ hg churn -c |
|
112 | $ hg churn -c | |
113 | user1 4 *************************************************************** |
|
113 | user1 4 *************************************************************** | |
114 | user3 3 *********************************************** |
|
114 | user3 3 *********************************************** | |
115 | user2 2 ******************************** |
|
115 | user2 2 ******************************** | |
116 |
|
116 | |||
117 | $ echo 'with space = no-space' >> ../aliases |
|
117 | $ echo 'with space = no-space' >> ../aliases | |
118 | $ echo a >> a |
|
118 | $ echo a >> a | |
119 | $ hg commit -m a -u 'with space' -d 15:00 |
|
119 | $ hg commit -m a -u 'with space' -d 15:00 | |
120 |
|
120 | |||
121 | churn with space in alias |
|
121 | churn with space in alias | |
122 |
|
122 | |||
123 | $ hg churn --aliases ../aliases -r tip |
|
123 | $ hg churn --aliases ../aliases -r tip | |
124 | no-space 1 ************************************************************ |
|
124 | no-space 1 ************************************************************ | |
125 |
|
125 | |||
126 | $ cd .. |
|
126 | $ cd .. | |
127 |
|
127 | |||
128 |
|
128 | |||
129 | Issue833: ZeroDivisionError |
|
129 | Issue833: ZeroDivisionError | |
130 |
|
130 | |||
131 | $ hg init issue-833 |
|
131 | $ hg init issue-833 | |
132 | $ cd issue-833 |
|
132 | $ cd issue-833 | |
133 | $ touch foo |
|
133 | $ touch foo | |
134 | $ hg ci -Am foo |
|
134 | $ hg ci -Am foo | |
135 | adding foo |
|
135 | adding foo | |
136 |
|
136 | |||
137 | this was failing with a ZeroDivisionError |
|
137 | this was failing with a ZeroDivisionError | |
138 |
|
138 | |||
139 | $ hg churn |
|
139 | $ hg churn | |
140 | test 0 |
|
140 | test 0 | |
141 | $ cd .. |
|
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 <user4@x.com>' | |||
|
148 | adding bar | |||
|
149 | $ touch foo | |||
|
150 | $ hg ci -Am'foo' -u 'user4 < user4@x.com >' | |||
|
151 | adding foo | |||
|
152 | $ hg log -l2 --template '[{author|email}]\n' | |||
|
153 | [ user4@x.com ] | |||
|
154 | [user4@x.com] | |||
|
155 | $ hg churn -c | |||
|
156 | user1 4 ********************************************************* | |||
|
157 | user3 3 ******************************************* | |||
|
158 | user4@x.com 2 ***************************** | |||
|
159 | user2 2 ***************************** | |||
|
160 | with space 1 ************** |
General Comments 0
You need to be logged in to leave comments.
Login now