Patchwork [7,of,8] resolve: 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 <c5970d8c9a15a4d4fbc1.1530624370@mimosa>
Download mbox | patch
Permalink /patch/32586/
State Accepted
Headers show

Comments

Yuya Nishihara - July 3, 2018, 1:26 p.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1530450683 -32400
#      Sun Jul 01 22:11:23 2018 +0900
# Node ID c5970d8c9a15a4d4fbc1562d819e5aef4186ef84
# Parent  367bf34872603a7c006c104b3cab8de1fba99077
resolve: add support for log-like template keywords and functions

It uses wctx as the associated revision since "hg resolve" is the command
to manipulate the working directory files.

Patch

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -4534,7 +4534,8 @@  def resolve(ui, repo, *pats, **opts):
         ui.pager('resolve')
         fm = ui.formatter('resolve', opts)
         ms = mergemod.mergestate.read(repo)
-        m = scmutil.match(repo[None], pats, opts)
+        wctx = repo[None]
+        m = scmutil.match(wctx, pats, opts)
 
         # Labels and keys based on merge state.  Unresolved path conflicts show
         # as 'P'.  Resolved path conflicts show as 'R', the same as normal
@@ -4554,6 +4555,7 @@  def resolve(ui, repo, *pats, **opts):
 
             label, key = mergestateinfo[ms[f]]
             fm.startitem()
+            fm.context(ctx=wctx)
             fm.condwrite(not nostatus, 'status', '%s ', key, label=label)
             fm.write('path', '%s\n', f, label=label)
         fm.end()
diff --git a/tests/test-resolve.t b/tests/test-resolve.t
--- a/tests/test-resolve.t
+++ b/tests/test-resolve.t
@@ -162,6 +162,10 @@  resolve -l should show resolved file as 
    }
   ]
 
+  $ hg resolve -l -T '{path} {status} {p1rev} {p2rev}\n'
+  file1 R 2 1
+  file2 U 2 1
+
 resolve -m without paths should mark all resolved
 
   $ hg resolve -m