Patchwork [2,of,3,v2] annotate: unify template output to use abspath

login
register
mail settings
Submitter timeless@mozdev.org
Date Feb. 26, 2016, 6:12 p.m.
Message ID <d66dc235bd21ed08c566.1456510361@waste.org>
Download mbox | patch
Permalink /patch/13424/
State Changes Requested
Delegated to: Yuya Nishihara
Headers show

Comments

timeless@mozdev.org - Feb. 26, 2016, 6:12 p.m.
# HG changeset patch
# User timeless <timeless@mozdev.org>
# Date 1456509834 0
#      Fri Feb 26 18:03:54 2016 +0000
# Node ID d66dc235bd21ed08c5661fd62604d0c1bcfd0f8a
# Parent  7e94be4f7b542404823ae92ce3c6518bdc7d7257
annotate: unify template output to use abspath

Before this change, annotate used "file", which was inaccurate,
the field is actually an abspath.
Yuya Nishihara - Feb. 27, 2016, 9:48 a.m.
On Fri, 26 Feb 2016 12:12:41 -0600, timeless wrote:
> # HG changeset patch
> # User timeless <timeless@mozdev.org>
> # Date 1456509834 0
> #      Fri Feb 26 18:03:54 2016 +0000
> # Node ID d66dc235bd21ed08c5661fd62604d0c1bcfd0f8a
> # Parent  7e94be4f7b542404823ae92ce3c6518bdc7d7257
> annotate: unify template output to use abspath

Needs "(BC)".

> Before this change, annotate used "file", which was inaccurate,
> the field is actually an abspath.

Still 'abspath' doesn't agree with the log template.

  $ hg log -T '{files % "{file} "}\n'

Patch

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -390,7 +390,11 @@ 
              ('file', ' ', lambda x: x[0].path(), str),
              ('line_number', ':', lambda x: x[1], str),
             ]
-    fieldnamemap = {'number': 'rev', 'changeset': 'node'}
+    fieldnamemap = {
+             'changeset': 'node',
+             'file': 'abspath',
+             'number': 'rev',
+            }
 
     if (not opts.get('user') and not opts.get('changeset')
         and not opts.get('date') and not opts.get('file')):
diff --git a/tests/test-annotate.t b/tests/test-annotate.t
--- a/tests/test-annotate.t
+++ b/tests/test-annotate.t
@@ -64,8 +64,8 @@ 
   $ hg annotate -Tjson -cdfnul a
   [
    {
+    "abspath": "a",
     "date": [1.0, 0],
-    "file": "a",
     "line": "a\n",
     "line_number": 1,
     "node": "8435f90966e442695d2ded29fdade2bac5ad8065",