mirror of
https://github.com/facebook/sapling.git
synced 2024-10-11 09:17:30 +03:00
c12e300bb8
Summary: Move top-level Python packages `mercurial`, `hgext` and `hgdemandimport` to a new top-level package `edenscm`. This allows the Python packages provided by the upstream Mercurial to be installed side-by-side. To maintain compatibility, `edenscm/` gets added to `sys.path` in `mercurial/__init__.py`. Reviewed By: phillco, ikostia Differential Revision: D13853115 fbshipit-source-id: b296b0673dc54c61ef6a591ebc687057ff53b22e
131 lines
3.6 KiB
Perl
131 lines
3.6 KiB
Perl
Setup
|
|
|
|
$ cat >> $HGRCPATH << EOF
|
|
> [extensions]
|
|
> arcconfig=$TESTDIR/../edenscm/hgext/extlib/phabricator/arcconfig.py
|
|
> phabstatus=
|
|
> smartlog=
|
|
> EOF
|
|
$ hg init repo
|
|
$ cd repo
|
|
$ touch foo
|
|
$ hg ci -qAm 'Differential Revision: https://phabricator.fb.com/D1'
|
|
|
|
With an invalid arc configuration
|
|
|
|
$ hg log -T '{syncstatus}\n' -r .
|
|
arcconfig configuration problem. No diff information can be provided.
|
|
Error info: no .arcconfig found
|
|
Error
|
|
|
|
Configure arc...
|
|
|
|
$ echo '{}' > .arcrc
|
|
$ echo '{"config" : {"default" : "https://a.com/api"}, "hosts" : {"https://a.com/api/" : { "user" : "testuser", "cert" : "garbage_cert"}}}' > .arcconfig
|
|
|
|
And now with bad responses:
|
|
|
|
$ cat > $TESTTMP/mockduit << EOF
|
|
> [{}]
|
|
> EOF
|
|
$ HG_ARC_CONDUIT_MOCK=$TESTTMP/mockduit hg log -T '{syncstatus}\n' -r .
|
|
Error talking to phabricator. No diff information can be provided.
|
|
Error info: Unexpected graphql response format
|
|
Error
|
|
|
|
$ cat > $TESTTMP/mockduit << EOF
|
|
> [{"errors": [{"message": "failed, yo"}]}]
|
|
> EOF
|
|
$ HG_ARC_CONDUIT_MOCK=$TESTTMP/mockduit hg log -T '{syncstatus}\n' -r .
|
|
Error talking to phabricator. No diff information can be provided.
|
|
Error info: failed, yo
|
|
Error
|
|
|
|
Missing status field is treated as an error
|
|
|
|
$ cat > $TESTTMP/mockduit << EOF
|
|
> [{"data": {"query": [{"results": {"nodes": [{
|
|
> "number": 1,
|
|
> "latest_active_diff": {
|
|
> "local_commit_info": {
|
|
> "nodes": [
|
|
> {"property_value": "{\"lolwut\": {\"time\": 0, \"commit\": \"lolwut\"}}"}
|
|
> ]
|
|
> }
|
|
> },
|
|
> "differential_diffs": {"count": 3},
|
|
> "created_time": 123,
|
|
> "updated_time": 222
|
|
> }]}}]}}]
|
|
> EOF
|
|
$ HG_ARC_CONDUIT_MOCK=$TESTTMP/mockduit hg log -T '{syncstatus}\n' -r .
|
|
Error talking to phabricator. No diff information can be provided.
|
|
Error info: Unexpected graphql response format
|
|
Error
|
|
|
|
Missing count field is treated as an error
|
|
|
|
$ cat > $TESTTMP/mockduit << EOF
|
|
> [{"data": {"query": [{"results": {"nodes": [{
|
|
> "number": 1,
|
|
> "diff_status_name": "Approved",
|
|
> "latest_active_diff": {
|
|
> "local_commit_info": {
|
|
> "nodes": [
|
|
> {"property_value": "{\"lolwut\": {\"time\": 0, \"commit\": \"lolwut\"}}"}
|
|
> ]
|
|
> }
|
|
> },
|
|
> "created_time": 123,
|
|
> "updated_time": 222
|
|
> }]}}]}}]
|
|
> EOF
|
|
$ HG_ARC_CONDUIT_MOCK=$TESTTMP/mockduit hg log -T '{syncstatus}\n' -r .
|
|
Error talking to phabricator. No diff information can be provided.
|
|
Error info: Unexpected graphql response format
|
|
Error
|
|
|
|
Missing hash field is treated as unsync
|
|
|
|
$ cat > $TESTTMP/mockduit << EOF
|
|
> [{"data": {"query": [{"results": {"nodes": [{
|
|
> "number": 1,
|
|
> "diff_status_name": "Approved",
|
|
> "latest_active_diff": {
|
|
> "local_commit_info": {
|
|
> "nodes": [
|
|
> {"property_value": "{\"lolwut\": {\"time\": 0}}"}
|
|
> ]
|
|
> }
|
|
> },
|
|
> "differential_diffs": {"count": 3},
|
|
> "is_landing": false,
|
|
> "created_time": 123,
|
|
> "updated_time": 222
|
|
> }]}}]}}]
|
|
> EOF
|
|
$ HG_ARC_CONDUIT_MOCK=$TESTTMP/mockduit hg log -T '{syncstatus}\n' -r .
|
|
unsync
|
|
|
|
And finally, the success case
|
|
|
|
$ cat > $TESTTMP/mockduit << EOF
|
|
> [{"data": {"query": [{"results": {"nodes": [{
|
|
> "number": 1,
|
|
> "diff_status_name": "Committed",
|
|
> "latest_active_diff": {
|
|
> "local_commit_info": {
|
|
> "nodes": [
|
|
> {"property_value": "{\"lolwut\": {\"time\": 0, \"commit\": \"lolwut\"}}"}
|
|
> ]
|
|
> }
|
|
> },
|
|
> "differential_diffs": {"count": 3},
|
|
> "is_landing": false,
|
|
> "created_time": 123,
|
|
> "updated_time": 222
|
|
> }]}}]}}]
|
|
> EOF
|
|
$ HG_ARC_CONDUIT_MOCK=$TESTTMP/mockduit hg log -T '{syncstatus}\n' -r .
|
|
committed
|