Search code examples
mercurialtortoisehg

What is the return of hg tags --template "{date|isodate}\n"


I am using Mercurial "HG", I want to know what is the exactly output of

hg tags --template "{date|isodate}\n"

Solution

  • prepare MWE:

    hg init test1
    cd test1
    echo test this > file.txt
    hg commit -A -m "my 1st commit"
    hg tag mytag1
    

    --

    now try different templates for tags

    normal tags output:

    hg tags
    tip        1:e02e6bf615f5
    mytag1     0:0970400e2de4
    

    --

    now let's try with the tag name and the tag date in short format YYYY-MM-DD:

    hg tags --template "{tag} {date|shortdate}\n"
    tip 1970-01-01
    mytag1 1970-01-01
    

    --

    and finally, the one you asked (with only the ISO date):

    hg tags --template "{date|isodate}\n"
    1970-01-01 00:00 +0000
    1970-01-01 00:00 +0000
    

    --

    if your doubt is about the template filters:

    hg help template
    

    isodate Date. Returns the date in ISO 8601 format: "2009-08-18 13:00 +0200".