Submitter | Olle Lundberg |
---|---|
Date | Dec. 19, 2013, 1:08 a.m. |
Message ID | <daae1fe7a8ec64b7b7a3.1387415310@se-c02kq0dadr55.lan> |
Download | mbox | patch |
Permalink | /patch/3215/ |
State | Deferred, archived |
Headers | show |
Comments
On Thu, 2013-12-19 at 02:08 +0100, Olle Lundberg wrote: > # HG changeset patch > # User Olle Lundberg <olle.lundberg@gmail.com> > # 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. We've actually had $HGEDITOR/ui.editor/hgeditor precisely for this purpose for eight years. I'm not completely opposed to adding this, but with the hgeditor approach, I can get things like editor-colorized diffs or the ability to launch a GUI diff viewer.
Patch
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())