Ejemplo n.º 1
0
#!/usr/bin/env python

if __name__ == "__main__":
    import calendar
    import re
    import util

    test_date, sort, graph = util.parse_option()
    days = list(calendar.day_abbr)
    d = dict([(x, 0) for x in days])
    r = re.compile(r"^(\d{4}-\d{2}-\d{2}) (\S+) ")

    for x in util.popen_hg_log("--template", "{date|shortdate} {date|date}\n"):
        m = r.match(x)
        if m:
            date, day = m.groups()
            if test_date(date) and day in days:
                d[day] += 1
    if sort:
        l = sorted([(v, k) for k, v in d.items()])
        g = reversed([x[1] for x in l])
    else:
        g = days

    l = d.values()
    tot = sum(l)
    if graph:
        gfn = util.get_graph_bar_fn(17, max(l))
    else:
        gfn = None
Ejemplo n.º 2
0
#!/usr/bin/env python

if __name__ == '__main__':
    import re
    import util

    test_date, sort, graph = util.parse_option()
    d = dict([(x, 0) for x in range(24)])
    r = re.compile(r"^(\d{4}-\d{2}-\d{2}) (\d+):\d+ ")

    for x in util.popen_hg_log("--template", "{date|isodate}\n"):
        m = r.match(x)
        if m:
            date = m.group(1)
            hour = int(m.group(2))
            if test_date(date):
                d[hour] += 1
    if sort:
        l = sorted([(v, k) for k, v in d.items()])
        g = reversed([x[1] for x in l])
    else:
        g = range(24)

    l = d.values()
    tot = sum(l)
    if graph:
        gfn = util.get_graph_bar_fn(19, max(l))
    else:
        gfn = None

    for k in g: