Mercurial > dotfiles
view lib/hg/changelog/changelog.py @ 461:eb8891b1a6f5
Clone FZF and source its Vim plugin directly, use official hggit repo.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Tue, 09 Apr 2019 00:11:42 -0700 |
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'))