Patchwork D6857: uncommit: enable support for adding a note

login
register
mail settings
Submitter phabricator
Date Sept. 15, 2019, 4:57 a.m.
Message ID <differential-rev-PHID-DREV-kbjeo4dcljtyft2vcghf-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/41676/
State Superseded
Headers show

Comments

phabricator - Sept. 15, 2019, 4:57 a.m.
mharbison72 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  This comes from the evolve extension's version of uncommit.  The logic was
  already in place, and appears to be the last of the trivial things that can be
  enabled.
  
  Should these note options (including on amend) be marked advanced to keep the
  help text clutter level down?

REPOSITORY
  rHG Mercurial

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

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

CHANGE DETAILS




To: mharbison72, #hg-reviewers
Cc: mercurial-devel
phabricator - Sept. 16, 2019, 5:02 p.m.
This revision is now accepted and ready to land.
pulkit added a comment.
pulkit accepted this revision.


  > Should these note options (including on amend) be marked advanced to keep the
  > help text clutter level down?
  
  Maybe, I don't have strong opinion here on any of the options.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D6857/new/

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

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

Patch

diff --git a/tests/test-uncommit.t b/tests/test-uncommit.t
--- a/tests/test-uncommit.t
+++ b/tests/test-uncommit.t
@@ -36,6 +36,7 @@ 
   
       --keep                     allow an empty commit after uncommiting
       --allow-dirty-working-copy allow uncommit with outstanding changes
+   -n --note TEXT                store a note on uncommit
    -I --include PATTERN [+]      include names matching the given patterns
    -X --exclude PATTERN [+]      exclude names matching the given patterns
    -m --message TEXT             use text as commit message
@@ -570,7 +571,7 @@ 
 
   $ hg rollback -q --config ui.rollback=True
   $ cd dir
-  $ hg uncommit .
+  $ hg uncommit . -n 'this is a note'
   note: keeping empty commit
   $ hg status
   A dir/file2.txt
diff --git a/hgext/uncommit.py b/hgext/uncommit.py
--- a/hgext/uncommit.py
+++ b/hgext/uncommit.py
@@ -111,7 +111,8 @@ 
 @command('uncommit',
     [('', 'keep', None, _('allow an empty commit after uncommiting')),
      ('', 'allow-dirty-working-copy', False,
-    _('allow uncommit with outstanding changes'))
+    _('allow uncommit with outstanding changes')),
+     (b'n', b'note', b'', _(b'store a note on uncommit'), _(b'TEXT'))
     ] + commands.walkopts + commands.commitopts + commands.commitopts2
     + commands.commitopts3,
     _('[OPTION]... [FILE]...'),
@@ -129,6 +130,7 @@ 
     """
     opts = pycompat.byteskwargs(opts)
 
+    cmdutil.checknotesize(ui, opts)
     cmdutil.resolvecommitoptions(ui, opts)
 
     with repo.wlock(), repo.lock():