Patchwork [1,of,2] commands: unify template output to use name

login
register
mail settings
Submitter timeless@mozdev.org
Date Feb. 26, 2016, 5:12 p.m.
Message ID <7e94be4f7b542404823a.1456506728@waste.org>
Download mbox | patch
Permalink /patch/13419/
State Superseded
Headers show

Comments

timeless@mozdev.org - Feb. 26, 2016, 5:12 p.m.
# HG changeset patch
# User timeless <timeless@mozdev.org>
# Date 1456505030 0
#      Fri Feb 26 16:43:50 2016 +0000
# Node ID 7e94be4f7b542404823ae92ce3c6518bdc7d7257
# Parent  41dcd754526612c43b9695df8851557c851828ef
commands: unify template output to use name

Before this, hg bookmarks -T... and hg tags -T used
bookmark/tag respectively for the name of the repesective
bookmark/tag, but it is really a name, and there is no reason to
repeat "bookmark" or "tag" in a command named "bookmarks" or "tags",
obviously the things you will get will be bookmarks or tags.

Patch

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -1155,7 +1155,7 @@ 
             fm.startitem()
             if not ui.quiet:
                 fm.plain(' %s ' % prefix, label=label)
-            fm.write('bookmark', '%s', bmark, label=label)
+            fm.write('name', '%s', bmark, label=label)
             pad = " " * (25 - encoding.colwidth(bmark))
             fm.condwrite(not ui.quiet, 'rev node', pad + ' %d:%s',
                          repo.changelog.rev(n), hexfn(n), label=label)
@@ -6820,7 +6820,7 @@ 
             tagtype = 'local'
 
         fm.startitem()
-        fm.write('tag', '%s', t, label=label)
+        fm.write('name', '%s', t, label=label)
         fmt = " " * (30 - encoding.colwidth(t)) + ' %5d:%s'
         fm.condwrite(not ui.quiet, 'rev node', fmt,
                      repo.changelog.rev(n), hn, label=label)
diff --git a/tests/test-bookmarks.t b/tests/test-bookmarks.t
--- a/tests/test-bookmarks.t
+++ b/tests/test-bookmarks.t
@@ -67,19 +67,19 @@ 
   [
    {
     "active": false,
-    "bookmark": "X",
+    "name": "X",
     "node": "f7b1eb17ad24730a1651fccd46c43826d1bbc2ac",
     "rev": 0
    },
    {
     "active": true,
-    "bookmark": "X2",
+    "name": "X2",
     "node": "925d80f479bb026b0fb3deb27503780b13f74123",
     "rev": 1
    },
    {
     "active": false,
-    "bookmark": "Y",
+    "name": "Y",
     "node": "0000000000000000000000000000000000000000",
     "rev": -1
    }
diff --git a/tests/test-encoding.t b/tests/test-encoding.t
--- a/tests/test-encoding.t
+++ b/tests/test-encoding.t
@@ -184,15 +184,15 @@ 
   $ hg tags -Tjson
   [
    {
+    "name": "tip",
     "node": "a52c0692f24ad921c0a31e1736e7635a8b23b670",
     "rev": 5,
-    "tag": "tip",
     "type": ""
    },
    {
+    "name": "\xc3\xa9", (esc)
     "node": "ca661e7520dec3f5438a63590c350bebadb04989",
     "rev": 3,
-    "tag": "\xc3\xa9", (esc)
     "type": ""
    }
   ]