Patchwork D1095: amend: add a flag `-n/--note` to store note with amend

login
register
mail settings
Submitter phabricator
Date Oct. 15, 2017, 2:28 p.m.
Message ID <differential-rev-PHID-DREV-qzs4mmx6rkw3zmw7ttfa-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/24951/
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
  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.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  hgext/amend.py
  tests/test-amend.t

CHANGE DETAILS




To: pulkit, #hg-reviewers
Cc: mercurial-devel
phabricator - Oct. 16, 2017, 1:22 p.m.
yuja accepted this revision.
yuja added a comment.
This revision is now accepted and ready to land.


  Seems fine, though I don't know how the note will be displayed.
  
  FWIW, note cannot be a long sentence due to the storage limit.
  
    $ hg amend --note "$(yes | head -300 | tr -d '\n')"
    ...
    ProgrammingError: obsstore metadata value cannot be longer than 255 bytes ...

REPOSITORY
  rHG Mercurial

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

To: pulkit, #hg-reviewers, dlax, yuja
Cc: yuja, mercurial-devel
phabricator - Oct. 16, 2017, 1:54 p.m.
pulkit added a comment.


  In https://phab.mercurial-scm.org/D1095#18504, @yuja wrote:
  
  > Seems fine, though I don't know how the note will be displayed.
  
  
  We don't have a UI to display obsmarker in core, so for now extensions has to do this.
  
  > FWIW, note cannot be a long sentence due to the storage limit.
  > 
  >   $ hg amend --note "$(yes | head -300 | tr -d '\n')"
  >   ...
  >   ProgrammingError: obsstore metadata value cannot be longer than 255 bytes ...
  >    
  
  I will follow up to make sure we catch this before.

REPOSITORY
  rHG Mercurial

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

To: pulkit, #hg-reviewers, dlax, yuja
Cc: yuja, mercurial-devel
phabricator - Oct. 16, 2017, 2:50 p.m.
yuja added a comment.


  > We don't have a UI to display obsmarker in core, so for now extensions has to do this.
  
  I know. It would be nice if reviewers can know how the planned UI will be
  to determine whether only --note option should be in the next release or not.

REPOSITORY
  rHG Mercurial

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

To: pulkit, #hg-reviewers, dlax, yuja
Cc: yuja, mercurial-devel
phabricator - Oct. 16, 2017, 4:20 p.m.
pulkit added a comment.


  In https://phab.mercurial-scm.org/D1095#18566, @yuja wrote:
  
  > > We don't have a UI to display obsmarker in core, so for now extensions has to do this.
  >
  > I know. It would be nice if reviewers can know how the planned UI will be
  >  to determine whether only --note option should be in the next release or not.
  
  
  The UI is not completely planned. What I have in my mind is that it will be good thing to show in obsfate, may be smartlog and definitely it will be in obslog. The note can serve better than messages like "rewritten x,y,z". I will be working on improving the UI around obsolete markers thing in the next cycle and will be discussing these all with everyone interested.

REPOSITORY
  rHG Mercurial

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

To: pulkit, #hg-reviewers, dlax, yuja
Cc: yuja, mercurial-devel
phabricator - Oct. 17, 2017, 1:37 a.m.
durin42 added a comment.


  (Thanks to @yuja for reviewing this new feature so I could have more confidence landing the patch this late in the cycle.)

REPOSITORY
  rHG Mercurial

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

To: pulkit, #hg-reviewers, dlax, yuja, durin42
Cc: yuja, mercurial-devel

Patch

diff --git a/tests/test-amend.t b/tests/test-amend.t
--- a/tests/test-amend.t
+++ b/tests/test-amend.t
@@ -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
diff --git a/hgext/amend.py b/hgext/amend.py
--- a/hgext/amend.py
+++ b/hgext/amend.py
@@ -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)