changeset 34795:530b7361e3a9

amend: add a flag `-n/--note` to store note with amend This patch utilises the functionality added in previous patches and adds a flag to amend command in hgext/amend to add a note to the amend. Since the note is stored in the obsmarker metadata, this will only be useful when obsmarker creation is enabled, otherwise this is no-op. Not adding releasenotes part as we yet don't have a functionality in core to show the note. Differential Revision: https://phab.mercurial-scm.org/D1095
author Pulkit Goyal <7895pulkit@gmail.com>
date Sun, 15 Oct 2017 19:29:56 +0530
parents 5781e0931c16
children ed91846c29cf
files hgext/amend.py tests/test-amend.t
diffstat 2 files changed, 9 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/amend.py	Sun Oct 15 15:32:03 2017 +0530
+++ b/hgext/amend.py	Sun Oct 15 19:29:56 2017 +0530
@@ -33,6 +33,7 @@
       _('mark new/missing files as added/removed before committing')),
      ('e', 'edit', None, _('invoke editor on commit messages')),
      ('i', 'interactive', None, _('use interactive mode')),
+     ('n', 'note', '', _('store a note on the amend')),
     ] + cmdutil.walkopts + cmdutil.commitopts + cmdutil.commitopts2,
     _('[OPTION]... [FILE]...'),
     inferrepo=True)
--- a/tests/test-amend.t	Sun Oct 15 15:32:03 2017 +0530
+++ b/tests/test-amend.t	Sun Oct 15 19:29:56 2017 +0530
@@ -193,6 +193,14 @@
   |/
   o  0 426bada5c675 A
   
+Checking the note stored in the obsmarker
+
+  $ echo foo > bar
+  $ hg add bar
+  $ hg amend --note "adding bar"
+  $ hg debugobsolete -r .
+  112478962961147124edd43549aedd1a335e44bf be169c7e8dbe21cd10b3d79691cbe7f241e3c21c 0 (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'amend', 'user': 'test'}
+  be169c7e8dbe21cd10b3d79691cbe7f241e3c21c 16084da537dd8f84cfdb3055c633772269d62e1b 0 (Thu Jan 01 00:00:00 1970 +0000) {'note': 'adding bar', 'operation': 'amend', 'user': 'test'}
 #endif
 
 Cannot amend public changeset