hgweb: add phase to {changeset} template

It's pretty surprising phase wasn't part of this template call already.
We now expose {phase} to the {changeset} template and we expose this
data to JSON.

This brings JSON output in line with the output from `hg log -Tjson`.
The lone exception is hweb doesn't print the numeric rev. As has been
stated previously, I don't believe hgweb should be exposing these
unstable identifiers. (We can add them later if we really want them.)
There is still work to bring hgweb in parity with --verbose and
--debug output from the CLI.
This commit is contained in:
Gregory Szorc 2015-03-31 22:29:12 -07:00
parent 3b964c6e89
commit 35a9613552
3 changed files with 8 additions and 1 deletions

View File

@ -324,6 +324,7 @@ def changesetentry(web, req, tmpl, ctx):
desc=ctx.description(),
extra=ctx.extra(),
date=ctx.date(),
phase=ctx.phasestr(),
files=files,
diffsummary=lambda **x: diffsummary(diffstatsgen),
diffstat=diffstats,

View File

@ -11,7 +11,8 @@ changeset = '\{
"bookmarks": [{join(changesetbookmark, ", ")}],
"tags": [{join(changesettag, ", ")}],
"user": {author|json},
"parents": [{join(parent%changesetparent, ", ")}]
"parents": [{join(parent%changesetparent, ", ")}],
"phase": {phase|json}
}'
changesetbranch = '{name|json}'
changesetbookmark = '{bookmark|json}'

View File

@ -22,6 +22,7 @@
$ hg mv foo foo-new
$ hg commit -m 'move foo'
$ hg tag -m 'create tag' tag1
$ hg phase --public -r .
$ echo baz > da/foo
$ hg commit -m 'another commit to da/foo'
$ hg tag -m 'create tag2' tag2
@ -162,6 +163,7 @@ changeset/ renders the tip changeset
"ceed296fe500c3fac9541e31dad860cb49c89e45",
"ed66c30e87eb65337c05a4229efaa5f1d5285a90"
],
"phase": "draft",
"tags": [
"tip"
],
@ -185,6 +187,7 @@ changeset/{revision} shows tags
"parents": [
"8d7c456572acf3557e8ed8a07286b10c408bcec5"
],
"phase": "public",
"tags": [
"tag1"
],
@ -210,6 +213,7 @@ changeset/{revision} shows bookmarks
"parents": [
"f8bbb9024b10f93cdbb8d940337398291d40dea8"
],
"phase": "public",
"tags": [],
"user": "test"
}
@ -231,6 +235,7 @@ changeset/{revision} shows branches
"parents": [
"06e557f3edf66faa1ccaba5dd8c203c21cc79f1e"
],
"phase": "draft",
"tags": [],
"user": "test"
}