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.
--- a/mercurial/hgweb/webutil.py Tue Mar 31 22:35:12 2015 -0700
+++ b/mercurial/hgweb/webutil.py Tue Mar 31 22:29:12 2015 -0700
@@ -324,6 +324,7 @@
desc=ctx.description(),
extra=ctx.extra(),
date=ctx.date(),
+ phase=ctx.phasestr(),
files=files,
diffsummary=lambda **x: diffsummary(diffstatsgen),
diffstat=diffstats,
--- a/mercurial/templates/json/map Tue Mar 31 22:35:12 2015 -0700
+++ b/mercurial/templates/json/map Tue Mar 31 22:29:12 2015 -0700
@@ -11,7 +11,8 @@
"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}'
--- a/tests/test-hgweb-json.t Tue Mar 31 22:35:12 2015 -0700
+++ b/tests/test-hgweb-json.t Tue Mar 31 22:29:12 2015 -0700
@@ -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 @@
"ceed296fe500c3fac9541e31dad860cb49c89e45",
"ed66c30e87eb65337c05a4229efaa5f1d5285a90"
],
+ "phase": "draft",
"tags": [
"tip"
],
@@ -185,6 +187,7 @@
"parents": [
"8d7c456572acf3557e8ed8a07286b10c408bcec5"
],
+ "phase": "public",
"tags": [
"tag1"
],
@@ -210,6 +213,7 @@
"parents": [
"f8bbb9024b10f93cdbb8d940337398291d40dea8"
],
+ "phase": "public",
"tags": [],
"user": "test"
}
@@ -231,6 +235,7 @@
"parents": [
"06e557f3edf66faa1ccaba5dd8c203c21cc79f1e"
],
+ "phase": "draft",
"tags": [],
"user": "test"
}