[PATCH 8 of 8] status: add support for log-like template keywords and functions

Yuya Nishihara yuya at tcha.org
Tue Jul 3 09:26:11 EDT 2018


# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# Date 1530451126 -32400
#      Sun Jul 01 22:18:46 2018 +0900
# Node ID 3b536d74a296aadb1e8b15edb446ed7709b8e5ec
# Parent  c5970d8c9a15a4d4fbc1562d819e5aef4186ef84
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.

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -5117,6 +5117,7 @@ def status(ui, repo, *pats, **opts):
             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:
diff --git a/tests/test-status.t b/tests/test-status.t
--- a/tests/test-status.t
+++ b/tests/test-status.t
@@ -213,6 +213,16 @@ hg status -A:
   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
   [
    {


More information about the Mercurial-devel mailing list