Bug 1251652 - Add pushdate, pushid and pushuser in json-changeset; r?gps draft
authorCalixte Denizet <cdenizet@mozilla.com>
Fri, 26 Feb 2016 19:43:28 +0100
changeset 7343 f6542070b4c7ec36695527ca088d2a620f869907
parent 7328 5d4fcdd28be544fac0bab646f9ba8612f09cdd63
push id665
push usercdenizet@mozilla.com
push dateSat, 27 Feb 2016 15:18:17 +0000
reviewersgps
bugs1251652
Bug 1251652 - Add pushdate, pushid and pushuser in json-changeset; r?gps MozReview-Commit-ID: HBGHhSm2HIk
hgext/hgmo/tests/test-json-changeset.t
hgtemplates/json/map
new file mode 100644
--- /dev/null
+++ b/hgext/hgmo/tests/test-json-changeset.t
@@ -0,0 +1,55 @@
+  $ export USER=hguser
+  $ . $TESTDIR/hgext/hgmo/tests/helpers.sh
+  $ startserver
+
+  $ hg -q clone http://localhost:$HGPORT client
+  $ cd client
+
+  $ echo initial > foo
+  $ hg -q commit -A -m 'Bug 271; r=calixte'
+  $ hg -q push
+  $ echo second > foo
+  $ cat > message << EOF
+  > Bug 828 - Do foo; r=calixte
+  > 
+  > This is related to bug 182.
+  > EOF
+  $ hg commit -l message
+  $ hg -q push
+
+  $ echo third > foo
+  $ hg commit -m 'NO BUG'
+
+  $ hg -q push
+
+Last changeset
+
+  $ http http://localhost:$HGPORT/json-changeset/tip --header content-type --body-file body
+  200
+  content-type: application/json
+
+  $ python -m json.tool < body
+  {
+      "bookmarks": [],
+      "branch": "default",
+      "date": [
+          0.0,
+          0
+      ],
+      "desc": "NO BUG",
+      "node": "c761ad6d27c96f72f7e4637789e967c3f9730255",
+      "parents": [
+          "ef0e7ae3b607356f580e6d7671abea63db849cc2"
+      ],
+      "phase": "public",
+      "pushdate": [
+          \d+, (re)
+          \d+ (re)
+      ],
+      "pushid": 3,
+      "pushuser": "hguser",
+      "tags": [
+          "tip"
+      ],
+      "user": "test"
+  }
--- a/hgtemplates/json/map
+++ b/hgtemplates/json/map
@@ -46,17 +46,20 @@ 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}
+  "phase": {phase|json},
+  "pushid": {pushid|json},
+  "pushdate": {pushdate|json},
+  "pushuser": {pushuser|json}
   }'
 changesetbranch = '{name|json}'
 changesetbookmark = '{bookmark|json}'
 changesettag = '{tag|json}'
 changesetparent = '{node|json}'
 manifest = '\{
   "node": {node|json},
   "abspath": {path|json},