Mercurial > public > mercurial-scm > hg
comparison hgext/phabricator.py @ 44393:adb93aa98c78
phabricator: update the protocol documentation
The `branch` property wasn't added to the `hg:meta` example when it was added to
the metadata in d49ab47be8a6. Additionally, `properties` in the Differential
Revision dict is a dinctionary, not a list. While here, also alphabetize the
responses from Phabricator because that's how it is being printed with
`hg debugcallconduit`, and this makes it easier to compare.
Differential Revision: https://phab.mercurial-scm.org/D8170
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Wed, 26 Feb 2020 14:43:02 -0500 |
parents | d1177d39012e |
children | 41217dfa7a6d |
comparison
equal
deleted
inserted
replaced
44392:efd73cdcfbac | 44393:adb93aa98c78 |
---|---|
1405 for details. | 1405 for details. |
1406 | 1406 |
1407 A "Differential Revision dict" looks like: | 1407 A "Differential Revision dict" looks like: |
1408 | 1408 |
1409 { | 1409 { |
1410 "id": "2", | 1410 "activeDiffPHID": "PHID-DIFF-xoqnjkobbm6k4dk6hi72", |
1411 "phid": "PHID-DREV-672qvysjcczopag46qty", | 1411 "authorPHID": "PHID-USER-tv3ohwc4v4jeu34otlye", |
1412 "title": "example", | 1412 "auxiliary": { |
1413 "uri": "https://phab.example.com/D2", | 1413 "phabricator:depends-on": [ |
1414 "PHID-DREV-gbapp366kutjebt7agcd" | |
1415 ] | |
1416 "phabricator:projects": [], | |
1417 }, | |
1418 "branch": "default", | |
1419 "ccs": [], | |
1420 "commits": [], | |
1414 "dateCreated": "1499181406", | 1421 "dateCreated": "1499181406", |
1415 "dateModified": "1499182103", | 1422 "dateModified": "1499182103", |
1416 "authorPHID": "PHID-USER-tv3ohwc4v4jeu34otlye", | |
1417 "status": "0", | |
1418 "statusName": "Needs Review", | |
1419 "properties": [], | |
1420 "branch": null, | |
1421 "summary": "", | |
1422 "testPlan": "", | |
1423 "lineCount": "2", | |
1424 "activeDiffPHID": "PHID-DIFF-xoqnjkobbm6k4dk6hi72", | |
1425 "diffs": [ | 1423 "diffs": [ |
1426 "3", | 1424 "3", |
1427 "4", | 1425 "4", |
1428 ], | 1426 ], |
1429 "commits": [], | 1427 "hashes": [], |
1428 "id": "2", | |
1429 "lineCount": "2", | |
1430 "phid": "PHID-DREV-672qvysjcczopag46qty", | |
1431 "properties": {}, | |
1432 "repositoryPHID": "PHID-REPO-hub2hx62ieuqeheznasv", | |
1430 "reviewers": [], | 1433 "reviewers": [], |
1431 "ccs": [], | |
1432 "hashes": [], | |
1433 "auxiliary": { | |
1434 "phabricator:projects": [], | |
1435 "phabricator:depends-on": [ | |
1436 "PHID-DREV-gbapp366kutjebt7agcd" | |
1437 ] | |
1438 }, | |
1439 "repositoryPHID": "PHID-REPO-hub2hx62ieuqeheznasv", | |
1440 "sourcePath": null | 1434 "sourcePath": null |
1435 "status": "0", | |
1436 "statusName": "Needs Review", | |
1437 "summary": "", | |
1438 "testPlan": "", | |
1439 "title": "example", | |
1440 "uri": "https://phab.example.com/D2", | |
1441 } | 1441 } |
1442 """ | 1442 """ |
1443 # TODO: replace differential.query and differential.querydiffs with | |
1444 # differential.diff.search because the former (and their output) are | |
1445 # frozen, and planned to be deprecated and removed. | |
1443 | 1446 |
1444 def fetch(params): | 1447 def fetch(params): |
1445 """params -> single drev or None""" | 1448 """params -> single drev or None""" |
1446 key = (params.get(b'ids') or params.get(b'phids') or [None])[0] | 1449 key = (params.get(b'ids') or params.get(b'phids') or [None])[0] |
1447 if key in prefetched: | 1450 if key in prefetched: |
1542 | 1545 |
1543 The metadata could be "hg:meta", sent by phabsend, like: | 1546 The metadata could be "hg:meta", sent by phabsend, like: |
1544 | 1547 |
1545 "properties": { | 1548 "properties": { |
1546 "hg:meta": { | 1549 "hg:meta": { |
1550 "branch": "default", | |
1547 "date": "1499571514 25200", | 1551 "date": "1499571514 25200", |
1548 "node": "98c08acae292b2faf60a279b4189beb6cff1414d", | 1552 "node": "98c08acae292b2faf60a279b4189beb6cff1414d", |
1549 "user": "Foo Bar <foo@example.com>", | 1553 "user": "Foo Bar <foo@example.com>", |
1550 "parent": "6d0abad76b30e4724a37ab8721d630394070fe16" | 1554 "parent": "6d0abad76b30e4724a37ab8721d630394070fe16" |
1551 } | 1555 } |
1555 | 1559 |
1556 "properties": { | 1560 "properties": { |
1557 "local:commits": { | 1561 "local:commits": { |
1558 "98c08acae292b2faf60a279b4189beb6cff1414d": { | 1562 "98c08acae292b2faf60a279b4189beb6cff1414d": { |
1559 "author": "Foo Bar", | 1563 "author": "Foo Bar", |
1564 "authorEmail": "foo@example.com" | |
1565 "branch": "default", | |
1566 "commit": "98c08acae292b2faf60a279b4189beb6cff1414d", | |
1567 "local": "1000", | |
1568 "message": "...", | |
1569 "parents": ["6d0abad76b30e4724a37ab8721d630394070fe16"], | |
1570 "rev": "98c08acae292b2faf60a279b4189beb6cff1414d", | |
1571 "summary": "...", | |
1572 "tag": "", | |
1560 "time": 1499546314, | 1573 "time": 1499546314, |
1561 "branch": "default", | |
1562 "tag": "", | |
1563 "commit": "98c08acae292b2faf60a279b4189beb6cff1414d", | |
1564 "rev": "98c08acae292b2faf60a279b4189beb6cff1414d", | |
1565 "local": "1000", | |
1566 "parents": ["6d0abad76b30e4724a37ab8721d630394070fe16"], | |
1567 "summary": "...", | |
1568 "message": "...", | |
1569 "authorEmail": "foo@example.com" | |
1570 } | 1574 } |
1571 } | 1575 } |
1572 } | 1576 } |
1573 | 1577 |
1574 Note: metadata extracted from "local:commits" will lose time zone | 1578 Note: metadata extracted from "local:commits" will lose time zone |