mercurial/templates/json/map
author Gregory Szorc <gregory.szorc@gmail.com>
Tue, 31 Mar 2015 22:53:48 -0700
changeset 24588 0bf54479a9eb
parent 24564 5ec4bda3097a
child 24589 30a737ae9b7d
permissions -rw-r--r--
json: implement {shortlog} and {changelog} templates These are the same dispatch function under the hood. The only difference is the default number of entries to render and the template to use. So it makes sense to use a shared template. Format for {changelistentry} is similar to {changeset}. However, there are differences to argument names and their values preventing us from (easily) using the same template. (Perhaps there is room to consolidate the templates as a follow-up.) We're currently not recording some data in {changelistentry} that exists in {changeset}. This includes the branch name. This should be added in a follow-up. For now, something is better than nothing.

mimetype = 'application/json'
filerevision = '"not yet implemented"'
search = '"not yet implemented"'
# changelog and shortlog are the same web API but with different
# number of entries.
changelog = changelist.tmpl
shortlog = changelist.tmpl
changelistentry = '\{
  "node": {node|json},
  "date": {date|json},
  "desc": {desc|json},
  "bookmarks": [{join(bookmarks%changelistentryname, ", ")}],
  "tags": [{join(tags%changelistentryname, ", ")}],
  "user": {author|json}
  }'
changelistentryname = '{name|json}'
changeset = '\{
  "node": {node|json},
  "date": {date|json},
  "desc": {desc|json},
  "branch": {if(branch, branch%changesetbranch, "default"|json)},
  "bookmarks": [{join(changesetbookmark, ", ")}],
  "tags": [{join(changesettag, ", ")}],
  "user": {author|json},
  "parents": [{join(parent%changesetparent, ", ")}],
  "phase": {phase|json}
  }'
changesetbranch = '{name|json}'
changesetbookmark = '{bookmark|json}'
changesettag = '{tag|json}'
changesetparent = '{node|json}'
manifest = '"not yet implemented"'
tags = '\{
  "node": {node|json},
  "tags": [{join(entriesnotip%tagentry, ", ")}]
  }'
tagentry = '\{
  "tag": {tag|json},
  "node": {node|json},
  "date": {date|json}
  }'
bookmarks = '\{
  "node": {node|json},
  "bookmarks": [{join(entries%bookmarkentry, ", ")}]
  }'
bookmarkentry = '\{
  "bookmark": {bookmark|json},
  "node": {node|json},
  "date": {date|json}
  }'
branches = '\{
  "branches": [{join(entries%branchentry, ", ")}]
  }'
branchentry = '\{
  "branch": {branch|json},
  "node": {node|json},
  "date": {date|json},
  "status": {status|json}
  }'
summary = '"not yet implemented"'
filediff = '"not yet implemented"'
filecomparison = '"not yet implemented"'
fileannotate = '"not yet implemented"'
filelog = '"not yet implemented"'
graph = '"not yet implemented"'
helptopics = '"not yet implemented"'
help = '"not yet implemented"'
filenodelink = ''
filenolink = ''