author | František Kučera <franta-hg@frantovo.cz> |
Thu, 22 Oct 2020 01:51:32 +0200 | |
branch | v_0 |
changeset 317 | fce3d6290c40 |
parent 264 | d39cfc926f95 |
permissions | -rwxr-xr-x |
264 | 1 |
#!/bin/bash |
2 |
||
3 |
relpipe-in-hglog() { |
|
4 |
# on repositories with long history |
|
5 |
# it is good to process just a subset of the log using hg log parameters |
|
6 |
hg log --template xml \ |
|
7 |
| relpipe-in-xmltable \ |
|
8 |
--relation hg_log \ |
|
9 |
--records "/log/logentry" \ |
|
10 |
--attribute "revision" integer "@revision" \ |
|
11 |
--attribute "date" string "date" \ |
|
12 |
--attribute "hash" string "@node" \ |
|
13 |
--attribute "hash_short" string "substring(@node,1,12)" \ |
|
14 |
--attribute "branch" string "branch" \ |
|
15 |
--attribute "author_name" string "author" \ |
|
16 |
--attribute "message" string "msg" |
|
17 |
# --attribute "author_email" string "author/@email" \ |
|
18 |
} |
|
19 |
||
20 |
relpipe-in-hgtags() { |
|
21 |
hg tags \ |
|
22 |
| sed -E 's/([^ \s]+)\s+([0-9]+):(.*)/\1\n\2\n\3/g' \ |
|
23 |
| tr \\n \\0 \ |
|
24 |
| relpipe-in-cli \ |
|
317
fce3d6290c40
Release v0.16 – JACK MIDI output, ports + rename Guile to Scheme + improve CLI interfaces
František Kučera <franta-hg@frantovo.cz>
parents:
264
diff
changeset
|
25 |
--relation "hg_tags" \ |
fce3d6290c40
Release v0.16 – JACK MIDI output, ports + rename Guile to Scheme + improve CLI interfaces
František Kučera <franta-hg@frantovo.cz>
parents:
264
diff
changeset
|
26 |
--attribute "tag" string \ |
fce3d6290c40
Release v0.16 – JACK MIDI output, ports + rename Guile to Scheme + improve CLI interfaces
František Kučera <franta-hg@frantovo.cz>
parents:
264
diff
changeset
|
27 |
--attribute "revision" integer \ |
fce3d6290c40
Release v0.16 – JACK MIDI output, ports + rename Guile to Scheme + improve CLI interfaces
František Kučera <franta-hg@frantovo.cz>
parents:
264
diff
changeset
|
28 |
--attribute "hash_short" string |
264 | 29 |
} |
30 |
||
31 |
||
32 |
# just view everything: |
|
33 |
# (relpipe-in-hglog; relpipe-in-hgtags) | relpipe-out-tabular | less -RSi |
|
34 |
||
35 |
||
36 |
# filter and JOIN data, do some statistics: |
|
37 |
(relpipe-in-hglog; relpipe-in-hgtags) \ |
|
38 |
| relpipe-tr-sql \ |
|
39 |
--relation "tags" \ |
|
40 |
"SELECT |
|
41 |
t.*, |
|
42 |
l.date |
|
43 |
FROM hg_tags AS t |
|
44 |
JOIN hg_log AS l USING (hash_short)" \ |
|
45 |
--relation "filtered_log" \ |
|
46 |
"SELECT |
|
47 |
revision, |
|
48 |
date, |
|
49 |
hash_short, |
|
50 |
branch, |
|
51 |
author_name |
|
52 |
FROM hg_log |
|
53 |
ORDER BY revision DESC |
|
54 |
LIMIT ?" \ |
|
55 |
--parameter 10 \ |
|
56 |
--relation "author_statistics" \ |
|
57 |
"SELECT |
|
58 |
author_name, |
|
59 |
branch, |
|
60 |
count(*) AS count, |
|
61 |
min(date) AS first_commit, |
|
62 |
max(date) AS last_commit |
|
63 |
-- TODO: user proper data type for date |
|
64 |
FROM hg_log |
|
65 |
GROUP BY author_name, branch |
|
66 |
ORDER BY count" \ |
|
67 |
| relpipe-out-tabular |
|
68 |