status: add support for log-like template keywords and functions
authorYuya Nishihara <yuya@tcha.org>
Sun, 01 Jul 2018 22:18:46 +0900
changeset 38545 85e3aa21bcdc
parent 38544 e8c33e27ee9b
child 38546 731debab233f
status: add support for log-like template keywords and functions It's bound to ctx2 since "hg status" can be considered to show the status of the files at ctx2 given ctx1 as the base.
mercurial/commands.py
tests/test-status.t
--- a/mercurial/commands.py	Sun Jul 01 22:11:23 2018 +0900
+++ b/mercurial/commands.py	Sun Jul 01 22:18:46 2018 +0900
@@ -5117,6 +5117,7 @@
             label = 'status.' + state
             for f in files:
                 fm.startitem()
+                fm.context(ctx=ctx2)
                 fm.condwrite(showchar, 'status', '%s ', char, label=label)
                 fm.write('path', fmt, repo.pathto(f, cwd), label=label)
                 if f in copy:
--- a/tests/test-status.t	Sun Jul 01 22:11:23 2018 +0900
+++ b/tests/test-status.t	Sun Jul 01 22:18:46 2018 +0900
@@ -213,6 +213,16 @@
   C .hgignore
   C modified
 
+  $ hg status -A -T '{status} {path} {node|shortest}\n'
+  A added ffff
+  A copied ffff
+  R removed ffff
+  ! deleted ffff
+  ? unknown ffff
+  I ignored ffff
+  C .hgignore ffff
+  C modified ffff
+
   $ hg status -A -Tjson
   [
    {