comparison tests/test-phabricator.t @ 43260:ec4dfcc39638

phabricator: remove tests and all recordings The next commit is going to change the format of conduit API requests so none of the VCR recordings will match and all the tests will fail. Differential Revision: https://phab.mercurial-scm.org/D7051
author Ian Moody <moz-ian@perix.co.uk>
date Thu, 10 Oct 2019 18:44:58 +0100
parents 6fb281f39c25
children a5e3f38407cb
comparison
equal deleted inserted replaced
43259:162b81e65e60 43260:ec4dfcc39638
18 > # it back. The VCR transcripts will be auto-sanitised to replace your real 18 > # it back. The VCR transcripts will be auto-sanitised to replace your real
19 > # token with this value. 19 > # token with this value.
20 > hgphab.phabtoken = cli-hahayouwish 20 > hgphab.phabtoken = cli-hahayouwish
21 > EOF 21 > EOF
22 $ VCR="$TESTDIR/phabricator" 22 $ VCR="$TESTDIR/phabricator"
23
24 Error is handled reasonably. We override the phabtoken here so that
25 when you're developing changes to phabricator.py you can edit the
26 above config and have a real token in the test but not have to edit
27 this test.
28 $ hg phabread --config auth.hgphab.phabtoken=cli-notavalidtoken \
29 > --test-vcr "$VCR/phabread-conduit-error.json" D4480 | head
30 abort: Conduit Error (ERR-INVALID-AUTH): API token "cli-notavalidtoken" has the wrong length. API tokens should be 32 characters long.
31
32 Basic phabread:
33 $ hg phabread --test-vcr "$VCR/phabread-4480.json" D4480 | head
34 # HG changeset patch
35 # Date 1536771503 0
36 # Parent a5de21c9e3703f8e8eb064bd7d893ff2f703c66a
37 exchangev2: start to implement pull with wire protocol v2
38
39 Wire protocol version 2 will take a substantially different
40 approach to exchange than version 1 (at least as far as pulling
41 is concerned).
42
43 This commit establishes a new exchangev2 module for holding
44
45 phabupdate with an accept:
46 $ hg phabupdate --accept D4564 \
47 > -m 'I think I like where this is headed. Will read rest of series later.'\
48 > --test-vcr "$VCR/accept-4564.json"
49
50 Create a differential diff:
51 $ HGENCODING=utf-8; export HGENCODING
52 $ echo alpha > alpha
53 $ hg ci --addremove -m 'create alpha for phabricator test €'
54 adding alpha
55 $ hg phabsend -r . --test-vcr "$VCR/phabsend-create-alpha.json"
56 D1190 - created - d386117f30e6: create alpha for phabricator test \xe2\x82\xac (esc)
57 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/d386117f30e6-24ffe649-phabsend.hg
58 $ echo more >> alpha
59 $ HGEDITOR=true hg ci --amend
60 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/a86ed7d85e86-b7a54f3b-amend.hg
61 $ echo beta > beta
62 $ hg ci --addremove -m 'create beta for phabricator test'
63 adding beta
64 $ hg phabsend -r ".^::" --test-vcr "$VCR/phabsend-update-alpha-create-beta.json"
65 D1190 - updated - d940d39fb603: create alpha for phabricator test \xe2\x82\xac (esc)
66 D1191 - created - 4b2486dfc8c7: create beta for phabricator test
67 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/4b2486dfc8c7-d90584fa-phabsend.hg
68 $ unset HGENCODING
69
70 The amend won't explode after posting a public commit. The local tag is left
71 behind to identify it.
72
73 $ echo 'public change' > beta
74 $ hg ci -m 'create public change for phabricator testing'
75 $ hg phase --public .
76 $ echo 'draft change' > alpha
77 $ hg ci -m 'create draft change for phabricator testing'
78 $ hg phabsend --amend -r '.^::' --test-vcr "$VCR/phabsend-create-public.json"
79 D1192 - created - 24ffd6bca53a: create public change for phabricator testing
80 D1193 - created - ac331633be79: create draft change for phabricator testing
81 warning: not updating public commit 2:24ffd6bca53a
82 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/ac331633be79-719b961c-phabsend.hg
83 $ hg tags -v
84 tip 3:a19f1434f9a5
85 D1192 2:24ffd6bca53a local
86
87 $ hg debugcallconduit user.search --test-vcr "$VCR/phab-conduit.json" <<EOF
88 > {
89 > "constraints": {
90 > "isBot": true
91 > }
92 > }
93 > EOF
94 {
95 "cursor": {
96 "after": null,
97 "before": null,
98 "limit": 100,
99 "order": null
100 },
101 "data": [],
102 "maps": {},
103 "query": {
104 "queryKey": null
105 }
106 }
107
108 Template keywords
109 $ hg log -T'{rev} {phabreview|json}\n'
110 3 {"id": "D1193", "url": "https://phab.mercurial-scm.org/D1193"}
111 2 {"id": "D1192", "url": "https://phab.mercurial-scm.org/D1192"}
112 1 {"id": "D1191", "url": "https://phab.mercurial-scm.org/D1191"}
113 0 {"id": "D1190", "url": "https://phab.mercurial-scm.org/D1190"}
114
115 $ hg log -T'{rev} {if(phabreview, "{phabreview.url} {phabreview.id}")}\n'
116 3 https://phab.mercurial-scm.org/D1193 D1193
117 2 https://phab.mercurial-scm.org/D1192 D1192
118 1 https://phab.mercurial-scm.org/D1191 D1191
119 0 https://phab.mercurial-scm.org/D1190 D1190
120
121 Commenting when phabsending:
122 $ echo comment > comment
123 $ hg ci --addremove -m "create comment for phabricator test"
124 adding comment
125 $ hg phabsend -r . -m "For default branch" --test-vcr "$VCR/phabsend-comment-created.json"
126 D1253 - created - a7ee4bac036a: create comment for phabricator test
127 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/a7ee4bac036a-8009b5a0-phabsend.hg
128 $ echo comment2 >> comment
129 $ hg ci --amend
130 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/81fce7de1b7d-05339e5b-amend.hg
131 $ hg phabsend -r . -m "Address review comments" --test-vcr "$VCR/phabsend-comment-updated.json"
132 D1253 - updated - 1acd4b60af38: create comment for phabricator test
133
134 Phabsending a skipped commit:
135 $ hg phabsend --no-amend -r . --test-vcr "$VCR/phabsend-skipped.json"
136 D1253 - skipped - 1acd4b60af38: create comment for phabricator test
137
138 Phabreading a DREV with a local:commits time as a string:
139 $ hg phabread --test-vcr "$VCR/phabread-str-time.json" D1285
140 # HG changeset patch
141 # User test <test>
142 # Date 1562019844 0
143 # Branch default
144 # Node ID da5c8c6bf23a36b6e3af011bc3734460692c23ce
145 # Parent 1f634396406d03e565ed645370e5fecd062cf215
146 test string time
147
148 Differential Revision: https://phab.mercurial-scm.org/D1285
149 diff --git a/test b/test
150 new file mode 100644
151 --- /dev/null
152 +++ b/test
153 @@ * @@ (glob)
154 +test
155
156
157 $ cd ..