Patchwork [3,of,3] tags: use full hash for formatter output as in log or annotate commands

login
register
mail settings
Submitter Yuya Nishihara
Date Sept. 21, 2014, 4:53 a.m.
Message ID <c09a49bc5786f890d531.1411275211@mimosa>
Download mbox | patch
Permalink /patch/5904/
State Accepted
Headers show

Comments

Yuya Nishihara - Sept. 21, 2014, 4:53 a.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1411271448 -32400
#      Sun Sep 21 12:50:48 2014 +0900
# Node ID c09a49bc5786f890d531cbf7b3459d27d9cc9d3c
# Parent  e579ab975ff4e4c4b6ec37a82b81c4cd837df4b1
tags: use full hash for formatter output as in log or annotate commands
Augie Fackler - Sept. 23, 2014, 6:24 p.m.
On Sun, Sep 21, 2014 at 01:53:31PM +0900, Yuya Nishihara wrote:
> # HG changeset patch
> # User Yuya Nishihara <yuya@tcha.org>
> # Date 1411271448 -32400
> #      Sun Sep 21 12:50:48 2014 +0900
> # Node ID c09a49bc5786f890d531cbf7b3459d27d9cc9d3c
> # Parent  e579ab975ff4e4c4b6ec37a82b81c4cd837df4b1
> tags: use full hash for formatter output as in log or annotate commands

series looks good, queued, thanks

>
> diff --git a/mercurial/commands.py b/mercurial/commands.py
> --- a/mercurial/commands.py
> +++ b/mercurial/commands.py
> @@ -5997,7 +5997,10 @@ def tags(ui, repo, **opts):
>      """
>
>      fm = ui.formatter('tags', opts)
> -    hexfunc = ui.debugflag and hex or short
> +    if fm or ui.debugflag:
> +        hexfunc = hex
> +    else:
> +        hexfunc = short
>      tagtype = ""
>
>      for t, n in reversed(repo.tagslist()):
> diff --git a/tests/test-encoding.t b/tests/test-encoding.t
> --- a/tests/test-encoding.t
> +++ b/tests/test-encoding.t
> @@ -184,13 +184,13 @@ hg tags (JSON)
>    $ hg tags -Tjson
>    [
>     {
> -    "node": "a52c0692f24a",
> +    "node": "a52c0692f24ad921c0a31e1736e7635a8b23b670",
>      "rev": 5,
>      "tag": "tip",
>      "type": ""
>     },
>     {
> -    "node": "ca661e7520de",
> +    "node": "ca661e7520dec3f5438a63590c350bebadb04989",
>      "rev": 3,
>      "tag": "\xc3\xa9", (esc)
>      "type": ""
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel

Patch

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -5997,7 +5997,10 @@  def tags(ui, repo, **opts):
     """
 
     fm = ui.formatter('tags', opts)
-    hexfunc = ui.debugflag and hex or short
+    if fm or ui.debugflag:
+        hexfunc = hex
+    else:
+        hexfunc = short
     tagtype = ""
 
     for t, n in reversed(repo.tagslist()):
diff --git a/tests/test-encoding.t b/tests/test-encoding.t
--- a/tests/test-encoding.t
+++ b/tests/test-encoding.t
@@ -184,13 +184,13 @@  hg tags (JSON)
   $ hg tags -Tjson
   [
    {
-    "node": "a52c0692f24a",
+    "node": "a52c0692f24ad921c0a31e1736e7635a8b23b670",
     "rev": 5,
     "tag": "tip",
     "type": ""
    },
    {
-    "node": "ca661e7520de",
+    "node": "ca661e7520dec3f5438a63590c350bebadb04989",
     "rev": 3,
     "tag": "\xc3\xa9", (esc)
     "type": ""