amend: add support for storing a note in obsmarker
authorPulkit Goyal <7895pulkit@gmail.com>
Fri, 17 Nov 2017 03:14:47 +0530
changeset 3221 9f3521cc4c90
parent 3220 f0f4cc2febac
child 3222 adbae782aac7
amend: add support for storing a note in obsmarker
hgext3rd/evolve/cmdrewrite.py
tests/test-amend.t
tests/test-uncommit-interactive.t
--- a/hgext3rd/evolve/cmdrewrite.py	Fri Nov 17 03:14:31 2017 +0530
+++ b/hgext3rd/evolve/cmdrewrite.py	Fri Nov 17 03:14:47 2017 +0530
@@ -92,6 +92,7 @@
      ('', 'close-branch', None,
       _('mark a branch as closed, hiding it from the branch list')),
      ('s', 'secret', None, _('use the secret phase for committing')),
+     ('n', 'note', '', _('store a note on amend')),
     ] + walkopts + commitopts + commitopts2 + commitopts3 + interactiveopt,
     _('[OPTION]... [FILE]...'))
 def amend(ui, repo, *pats, **opts):
@@ -110,6 +111,7 @@
 
     Returns 0 on success, 1 if nothing changed.
     """
+    _checknotesize(opts)
     opts = opts.copy()
     if opts.get('extract'):
         return uncommit(ui, repo, *pats, **opts)
--- a/tests/test-amend.t	Fri Nov 17 03:14:31 2017 +0530
+++ b/tests/test-amend.t	Fri Nov 17 03:14:47 2017 +0530
@@ -18,9 +18,16 @@
   $ hg branch foo
   marked working directory as branch foo
   (branches are permanent and global, did you want a bookmark?)
-  $ hg amend -d '0 0'
+  $ hg amend -d '0 0' -n "this a note on the obsmarker and supported for hg>=4.4"
   $ hg debugobsolete
   07f4944404050f47db2e5c5071e0e84e7a27bba9 6a022cbb61d5ba0f03f98ff2d36319dfea1034ae 0 (*) {'ef1': '*', 'user': 'test'} (glob)
+  $ hg obslog
+  @  6a022cbb61d5 (1) adda
+  |
+  x  07f494440405 (0) adda
+       rewritten(branch) as 6a022cbb61d5 by test (Thu Jan 01 00:00:00 1970 +0000)
+         note: 'this a note on the obsmarker and supported for hg>=4.4'
+  
   $ hg branch
   foo
   $ hg branches
@@ -145,6 +152,7 @@
       --close-branch        mark a branch as closed, hiding it from the branch
                             list
    -s --secret              use the secret phase for committing
+   -n --note VALUE          store a note on amend
    -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
--- a/tests/test-uncommit-interactive.t	Fri Nov 17 03:14:31 2017 +0530
+++ b/tests/test-uncommit-interactive.t	Fri Nov 17 03:14:47 2017 +0530
@@ -128,7 +128,7 @@
 Uncommit a chunk
 ================
 
-  $ hg amend --extract -i<<EOF
+  $ hg amend --extract -n "note on amend --extract" -i<<EOF
   > y
   > y
   > n
@@ -163,6 +163,14 @@
   +babar
   discard change 3/3 to 'a'? [Ynesfdaq?] n
   
+
+  $ hg obslog
+  @  678a59e5ff90 (3) another one
+  |
+  x  f70fb463d5bf (1) another one
+       rewritten(content) as 678a59e5ff90 by test (Thu Jan 01 00:00:00 1970 +0000)
+         note: 'note on amend --extract'
+  
 The unselected part should be in the diff
 -----------------------------------------
 
@@ -297,6 +305,7 @@
   |
   x  f70fb463d5bf (1) another one
        rewritten(content) as 678a59e5ff90 by test (Thu Jan 01 00:00:00 1970 +0000)
+         note: 'note on amend --extract'
   
 
 Push the changes back to the commit and more commits for more testing