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

login
register
mail settings
Submitter Yuya Nishihara
Date July 3, 2018, 1:26 p.m.
Message ID <3b536d74a296aadb1e8b.1530624371@mimosa>
Download mbox | patch
Permalink /patch/32587/
State Accepted
Headers show

Comments

Yuya Nishihara - July 3, 2018, 1:26 p.m.
# HG changeset patch
# User Yuya Nishihara <yuya@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.

Patch

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
   [
    {