# HG changeset patch # User Ludovic Chabant # Date 1419470064 28800 # Node ID 792cbc7bae1d4302b332e8264bb67f811636d823 # Parent efff5f3e72bb9494f46d8d6173406f1ab50b0625 Add hg-changelog extension. diff -r efff5f3e72bb -r 792cbc7bae1d lib/hg/changelog/README.md --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lib/hg/changelog/README.md Wed Dec 24 17:14:24 2014 -0800 @@ -0,0 +1,10 @@ + +Release Notes Extension +----------------------- + +This extension adds a `releasenotes` command (also aliased to `rnotes`) that +helps generate release notes for the project in the repository. By default, it +will create a `ReleaseNotes.html` file, but you can specify another output file: + + hg rnotes -o SomeOtherFile.html + diff -r efff5f3e72bb -r 792cbc7bae1d lib/hg/changelog/changelog.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lib/hg/changelog/changelog.py Wed Dec 24 17:14:24 2014 -0800 @@ -0,0 +1,44 @@ +"""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')) + diff -r efff5f3e72bb -r 792cbc7bae1d lib/hg/changelog/changelog.pyc Binary file lib/hg/changelog/changelog.pyc has changed