Patchwork D1094: cmdutil: pass metadata from amend() to cleanupnodes

login
register
mail settings
Submitter phabricator
Date Oct. 15, 2017, 2:28 p.m.
Message ID <differential-rev-PHID-DREV-wznvnxniscf47uvto5er-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/24952/
State Superseded
Headers show

Comments

phabricator - Oct. 15, 2017, 2:28 p.m.
pulkit created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  `commit --amend` and amend command in core and extensions rely on
  cmdutil.amend() for amending a commit. So the logic to add a note to amend must
  reside here. This patch assumes that note will be passed in opts dictionary to
  the function and it will be passed to cleanupnodes and then createmarkers to
  store the note in the obsmarker metadata.
  
  After this patch, note can be stored on an amend changeset by passing notes as a
  part of opts to cmdutil.amend().

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D1094

AFFECTED FILES
  mercurial/cmdutil.py

CHANGE DETAILS




To: pulkit, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -3152,7 +3152,10 @@ 
         # Reroute the working copy parent to the new changeset
         repo.setparents(newid, nullid)
         mapping = {old.node(): (newid,)}
-        scmutil.cleanupnodes(repo, mapping, 'amend')
+        obsmetadata = None
+        if opts.get('note'):
+            obsmetadata = {'note': opts['note']}
+        scmutil.cleanupnodes(repo, mapping, 'amend', metadata=obsmetadata)
 
         # Fixing the dirstate because localrepo.commitctx does not update
         # it. This is rather convenient because we did not need to update