# HG changeset patch # User Gregory Szorc # Date 2015-04-01 05:29:12 # Node ID 5ec4bda3097ae4b970fd31af7d718e243b400955 # Parent 830280536946b6154be57902b5a1c36583583802 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. diff --git a/mercurial/hgweb/webutil.py b/mercurial/hgweb/webutil.py --- a/mercurial/hgweb/webutil.py +++ b/mercurial/hgweb/webutil.py @@ -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, diff --git a/mercurial/templates/json/map b/mercurial/templates/json/map --- a/mercurial/templates/json/map +++ b/mercurial/templates/json/map @@ -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}' diff --git a/tests/test-hgweb-json.t b/tests/test-hgweb-json.t --- a/tests/test-hgweb-json.t +++ b/tests/test-hgweb-json.t @@ -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" }