From patchwork Thu Dec 19 01:08:30 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: cmdutil: display changeset diff in commit editor if verbose From: Olle Lundberg X-Patchwork-Id: 3215 Message-Id: To: mercurial-devel@selenic.com Date: Thu, 19 Dec 2013 02:08:30 +0100 # HG changeset patch # User Olle Lundberg # Date 1387414111 -3600 # Thu Dec 19 01:48:31 2013 +0100 # Node ID daae1fe7a8ec64b7b7a385d4c11ca2833f62c91f # Parent 04036798ebed0c6d7062517bb49b308a15e4345e cmdutil: display changeset diff in commit editor if verbose This adds the ability to display the changeset of what is currently being commited. This feature exists in other VCSes and might ease the transition for new users of mercurial. diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py --- a/mercurial/cmdutil.py +++ b/mercurial/cmdutil.py @@ -1864,10 +1864,16 @@ edittext.extend([_("HG: added %s") % f for f in added]) edittext.extend([_("HG: changed %s") % f for f in modified]) edittext.extend([_("HG: removed %s") % f for f in removed]) if not added and not modified and not removed: edittext.append(_("HG: no files changed")) + else: + if repo.ui.verbose and util.safehasattr(ctx, 'diff'): + edittext.append("HG: --") + edittext.append(_("HG: changeset diff:")) + edittext.extend(["HG: %s" % line for diff in ctx.diff() + for line in diff.splitlines()]) edittext.append("") # run editor in the repository root olddir = os.getcwd() os.chdir(repo.root) text = repo.ui.edit("\n".join(edittext), ctx.user())