diff --git a/mercurial/templates/json/map b/mercurial/templates/json/map --- a/mercurial/templates/json/map +++ b/mercurial/templates/json/map @@ -9,10 +9,13 @@ changelistentry = '\{ "node": {node|json}, "date": {date|json}, "desc": {desc|utf8|json}, + "branch": {if(branch, branch%changesetbranch, "default"|json)}, "bookmarks": [{join(bookmarks%changelistentryname, ", ")}], "tags": [{join(tags%changelistentryname, ", ")}], "user": {author|utf8|json}, - "parents": [{join(allparents%changesetparent, ", ")}] + "phase": {phase|json}, + "parents": [{if(allparents, join(allparents%changesetparent, ", "), + join(parent%changesetparent, ", "))}] }' changelistentryname = '{name|utf8|json}' changeset = '\{ @@ -156,7 +159,9 @@ fileannotation = '\{ "lineno": {lineno|json}, "revdate": {revdate|json} }' -filelog = '"not yet implemented"' +filelog = '\{ + "entries": [{join(entries%changelistentry, ", ")}] + }' graph = '"not yet implemented"' helptopics = '\{ "topics": [{join(topics%helptopicentry, ", ")}], 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 @@ -169,6 +169,7 @@ changelog/ shows information about sever "changesets": [ { "bookmarks": [], + "branch": "default", "date": [ 0.0, 0 @@ -179,6 +180,7 @@ changelog/ shows information about sever "ceed296fe500c3fac9541e31dad860cb49c89e45", "ed66c30e87eb65337c05a4229efaa5f1d5285a90" ], + "phase": "draft", "tags": [ "tip" ], @@ -186,6 +188,7 @@ changelog/ shows information about sever }, { "bookmarks": [], + "branch": "test-branch", "date": [ 0.0, 0 @@ -195,11 +198,13 @@ changelog/ shows information about sever "parents": [ "6ab967a8ab3489227a83f80e920faa039a71819f" ], + "phase": "draft", "tags": [], "user": "test" }, { "bookmarks": [], + "branch": "test-branch", "date": [ 0.0, 0 @@ -209,6 +214,7 @@ changelog/ shows information about sever "parents": [ "06e557f3edf66faa1ccaba5dd8c203c21cc79f1e" ], + "phase": "draft", "tags": [], "user": "test" }, @@ -216,6 +222,7 @@ changelog/ shows information about sever "bookmarks": [ "bookmark2" ], + "branch": "default", "date": [ 0.0, 0 @@ -225,11 +232,13 @@ changelog/ shows information about sever "parents": [ "f2890a05fea49bfaf9fb27ed5490894eba32da78" ], + "phase": "draft", "tags": [], "user": "test" }, { "bookmarks": [], + "branch": "default", "date": [ 0.0, 0 @@ -239,6 +248,7 @@ changelog/ shows information about sever "parents": [ "93a8ce14f89156426b7fa981af8042da53f03aa0" ], + "phase": "draft", "tags": [ "tag2" ], @@ -246,6 +256,7 @@ changelog/ shows information about sever }, { "bookmarks": [], + "branch": "default", "date": [ 0.0, 0 @@ -255,11 +266,13 @@ changelog/ shows information about sever "parents": [ "78896eb0e102174ce9278438a95e12543e4367a7" ], + "phase": "public", "tags": [], "user": "test" }, { "bookmarks": [], + "branch": "default", "date": [ 0.0, 0 @@ -269,6 +282,7 @@ changelog/ shows information about sever "parents": [ "8d7c456572acf3557e8ed8a07286b10c408bcec5" ], + "phase": "public", "tags": [ "tag1" ], @@ -278,6 +292,7 @@ changelog/ shows information about sever "bookmarks": [ "bookmark1" ], + "branch": "default", "date": [ 0.0, 0 @@ -287,11 +302,13 @@ changelog/ shows information about sever "parents": [ "f8bbb9024b10f93cdbb8d940337398291d40dea8" ], + "phase": "public", "tags": [], "user": "test" }, { "bookmarks": [], + "branch": "default", "date": [ 0.0, 0 @@ -301,11 +318,13 @@ changelog/ shows information about sever "parents": [ "06e557f3edf66faa1ccaba5dd8c203c21cc79f1e" ], + "phase": "public", "tags": [], "user": "test" }, { "bookmarks": [], + "branch": "default", "date": [ 0.0, 0 @@ -313,6 +332,7 @@ changelog/ shows information about sever "desc": "initial", "node": "06e557f3edf66faa1ccaba5dd8c203c21cc79f1e", "parents": [], + "phase": "public", "tags": [], "user": "test" } @@ -330,6 +350,7 @@ changelog/{revision} shows information s "changesets": [ { "bookmarks": [], + "branch": "default", "date": [ 0.0, 0 @@ -339,11 +360,13 @@ changelog/{revision} shows information s "parents": [ "06e557f3edf66faa1ccaba5dd8c203c21cc79f1e" ], + "phase": "public", "tags": [], "user": "test" }, { "bookmarks": [], + "branch": "default", "date": [ 0.0, 0 @@ -351,6 +374,7 @@ changelog/{revision} shows information s "desc": "initial", "node": "06e557f3edf66faa1ccaba5dd8c203c21cc79f1e", "parents": [], + "phase": "public", "tags": [], "user": "test" } @@ -368,6 +392,7 @@ shortlog/ shows information about a set "changesets": [ { "bookmarks": [], + "branch": "default", "date": [ 0.0, 0 @@ -378,6 +403,7 @@ shortlog/ shows information about a set "ceed296fe500c3fac9541e31dad860cb49c89e45", "ed66c30e87eb65337c05a4229efaa5f1d5285a90" ], + "phase": "draft", "tags": [ "tip" ], @@ -385,6 +411,7 @@ shortlog/ shows information about a set }, { "bookmarks": [], + "branch": "test-branch", "date": [ 0.0, 0 @@ -394,11 +421,13 @@ shortlog/ shows information about a set "parents": [ "6ab967a8ab3489227a83f80e920faa039a71819f" ], + "phase": "draft", "tags": [], "user": "test" }, { "bookmarks": [], + "branch": "test-branch", "date": [ 0.0, 0 @@ -408,6 +437,7 @@ shortlog/ shows information about a set "parents": [ "06e557f3edf66faa1ccaba5dd8c203c21cc79f1e" ], + "phase": "draft", "tags": [], "user": "test" }, @@ -415,6 +445,7 @@ shortlog/ shows information about a set "bookmarks": [ "bookmark2" ], + "branch": "default", "date": [ 0.0, 0 @@ -424,11 +455,13 @@ shortlog/ shows information about a set "parents": [ "f2890a05fea49bfaf9fb27ed5490894eba32da78" ], + "phase": "draft", "tags": [], "user": "test" }, { "bookmarks": [], + "branch": "default", "date": [ 0.0, 0 @@ -438,6 +471,7 @@ shortlog/ shows information about a set "parents": [ "93a8ce14f89156426b7fa981af8042da53f03aa0" ], + "phase": "draft", "tags": [ "tag2" ], @@ -445,6 +479,7 @@ shortlog/ shows information about a set }, { "bookmarks": [], + "branch": "default", "date": [ 0.0, 0 @@ -454,11 +489,13 @@ shortlog/ shows information about a set "parents": [ "78896eb0e102174ce9278438a95e12543e4367a7" ], + "phase": "public", "tags": [], "user": "test" }, { "bookmarks": [], + "branch": "default", "date": [ 0.0, 0 @@ -468,6 +505,7 @@ shortlog/ shows information about a set "parents": [ "8d7c456572acf3557e8ed8a07286b10c408bcec5" ], + "phase": "public", "tags": [ "tag1" ], @@ -477,6 +515,7 @@ shortlog/ shows information about a set "bookmarks": [ "bookmark1" ], + "branch": "default", "date": [ 0.0, 0 @@ -486,11 +525,13 @@ shortlog/ shows information about a set "parents": [ "f8bbb9024b10f93cdbb8d940337398291d40dea8" ], + "phase": "public", "tags": [], "user": "test" }, { "bookmarks": [], + "branch": "default", "date": [ 0.0, 0 @@ -500,11 +541,13 @@ shortlog/ shows information about a set "parents": [ "06e557f3edf66faa1ccaba5dd8c203c21cc79f1e" ], + "phase": "public", "tags": [], "user": "test" }, { "bookmarks": [], + "branch": "default", "date": [ 0.0, 0 @@ -512,6 +555,7 @@ shortlog/ shows information about a set "desc": "initial", "node": "06e557f3edf66faa1ccaba5dd8c203c21cc79f1e", "parents": [], + "phase": "public", "tags": [], "user": "test" } @@ -862,7 +906,98 @@ filelog/{revision}/{path} shows history $ request json-filelog/f8bbb9024b10/foo 200 Script output follows - "not yet implemented" + { + "entries": [ + { + "bookmarks": [], + "branch": "default", + "date": [ + 0.0, + 0 + ], + "desc": "modify foo", + "node": "f8bbb9024b10f93cdbb8d940337398291d40dea8", + "parents": [ + "06e557f3edf66faa1ccaba5dd8c203c21cc79f1e" + ], + "phase": "public", + "tags": [], + "user": "test" + }, + { + "bookmarks": [], + "branch": "default", + "date": [ + 0.0, + 0 + ], + "desc": "initial", + "node": "06e557f3edf66faa1ccaba5dd8c203c21cc79f1e", + "parents": [], + "phase": "public", + "tags": [], + "user": "test" + } + ] + } + + $ request json-filelog/cc725e08502a/da/foo + 200 Script output follows + + { + "entries": [ + { + "bookmarks": [], + "branch": "default", + "date": [ + 0.0, + 0 + ], + "desc": "another commit to da/foo", + "node": "f2890a05fea49bfaf9fb27ed5490894eba32da78", + "parents": [ + "8d7c456572acf3557e8ed8a07286b10c408bcec5" + ], + "phase": "draft", + "tags": [ + "tag2" + ], + "user": "test" + }, + { + "bookmarks": [ + "bookmark1" + ], + "branch": "default", + "date": [ + 0.0, + 0 + ], + "desc": "modify da/foo", + "node": "8d7c456572acf3557e8ed8a07286b10c408bcec5", + "parents": [ + "06e557f3edf66faa1ccaba5dd8c203c21cc79f1e" + ], + "phase": "public", + "tags": [], + "user": "test" + }, + { + "bookmarks": [], + "branch": "default", + "date": [ + 0.0, + 0 + ], + "desc": "initial", + "node": "06e557f3edf66faa1ccaba5dd8c203c21cc79f1e", + "parents": [], + "phase": "public", + "tags": [], + "user": "test" + } + ] + } (archive/ doesn't use templating, so ignore it)