view lib/hg/changelog/changelog.py @ 364:028682973dfc

Update subrepos.
author Ludovic Chabant <ludovic@chabant.com>
date Wed, 15 Feb 2017 23:09:55 -0800
parents 792cbc7bae1d
children
line wrap: on
line source

"""changelog

Generates a user-centric changelog from commit messages
"""
import re
import markdown
from mercurial import command, util, cmdutil, scmutil, graphmod
from mercurial.i18n import _

cmdtable = {}
command = cmdutil.command(cmdtable)

@command('changelog',
    [
        ('l', 'limit', '', _('limit number of changes included in the changelog'), _('NUM')),
        ('r', 'rev', [], _('include the specified revision or range'), _('REV')),
    ],
    _('hg changelog [OPTION]... [FILE]'))
def changelog(ui, repo, *pats, **opts):
    """generate a changelog from the revision history
    """
    rev = opts.get('rev')
    if not rev:
        rev = ['all()']
    revs = sorted(scmutil.revrange(repo, rev), reverse=1)
    limit = cmdutil.loglimit(opts)
    if limit is not None:
        revs = revs[:limit]

    dateformat = ui.config('changelog', 'dateformat', '%B %d, %Y')
    
    entries = [i for i in ui.configitems('changelog') if i[0].startswith('entry')]
    ui.write(entries)
    ui.write("\n")

    ui.write("Generating changelog from:\n")
    revdag = graphmod.dagwalker(repo, revs)
    for rev, t, ctx, parents in revdag:
        ui.write('%s: %s %s %s\n' % (util.datestr(ctx.date(), dateformat), rev, t, ctx.description()))

    ui.write("\n")
    ui.write("foo = %s\n" % ui.config('changelog', 'foo'))
    ui.write("blah = %s\n" % ui.config('changelog', 'blah'))