Show More
@@ -1,383 +1,374 b'' | |||||
1 | #require vcr |
|
1 | #require vcr | |
2 | $ cat >> $HGRCPATH <<EOF |
|
2 | $ cat >> $HGRCPATH <<EOF | |
3 | > [extensions] |
|
3 | > [extensions] | |
4 | > phabricator = |
|
4 | > phabricator = | |
5 | > EOF |
|
5 | > EOF | |
6 | $ hg init repo |
|
6 | $ hg init repo | |
7 | $ cd repo |
|
7 | $ cd repo | |
8 | $ cat >> .hg/hgrc <<EOF |
|
8 | $ cat >> .hg/hgrc <<EOF | |
9 | > [phabricator] |
|
9 | > [phabricator] | |
10 | > url = https://phab.mercurial-scm.org/ |
|
10 | > url = https://phab.mercurial-scm.org/ | |
11 | > callsign = HG |
|
11 | > callsign = HG | |
12 | > |
|
12 | > | |
13 | > [auth] |
|
13 | > [auth] | |
14 | > hgphab.schemes = https |
|
14 | > hgphab.schemes = https | |
15 | > hgphab.prefix = phab.mercurial-scm.org |
|
15 | > hgphab.prefix = phab.mercurial-scm.org | |
16 | > # When working on the extension and making phabricator interaction |
|
16 | > # When working on the extension and making phabricator interaction | |
17 | > # changes, edit this to be a real phabricator token. When done, edit |
|
17 | > # changes, edit this to be a real phabricator token. When done, edit | |
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 |
|
23 | |||
24 | Error is handled reasonably. We override the phabtoken here so that |
|
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 |
|
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 |
|
26 | above config and have a real token in the test but not have to edit | |
27 | this test. |
|
27 | this test. | |
28 | $ hg phabread --config auth.hgphab.phabtoken=cli-notavalidtoken \ |
|
28 | $ hg phabread --config auth.hgphab.phabtoken=cli-notavalidtoken \ | |
29 | > --test-vcr "$VCR/phabread-conduit-error.json" D4480 | head |
|
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. |
|
30 | abort: Conduit Error (ERR-INVALID-AUTH): API token "cli-notavalidtoken" has the wrong length. API tokens should be 32 characters long. | |
31 |
|
31 | |||
32 | Missing arguments print the command help |
|
32 | Missing arguments print the command help | |
33 |
|
33 | |||
34 | $ hg phabread |
|
34 | $ hg phabread | |
35 | hg phabread: invalid arguments |
|
35 | hg phabread: invalid arguments | |
36 | hg phabread DREVSPEC [OPTIONS] |
|
36 | hg phabread DREVSPEC [OPTIONS] | |
37 |
|
37 | |||
38 | print patches from Phabricator suitable for importing |
|
38 | print patches from Phabricator suitable for importing | |
39 |
|
39 | |||
40 | options: |
|
40 | options: | |
41 |
|
41 | |||
42 | --stack read dependencies |
|
42 | --stack read dependencies | |
43 |
|
43 | |||
44 | (use 'hg phabread -h' to show more help) |
|
44 | (use 'hg phabread -h' to show more help) | |
45 | [255] |
|
45 | [255] | |
46 |
|
46 | |||
47 | Basic phabread: |
|
47 | Basic phabread: | |
48 | $ hg phabread --test-vcr "$VCR/phabread-4480.json" D4480 | head |
|
48 | $ hg phabread --test-vcr "$VCR/phabread-4480.json" D4480 | head | |
49 | # HG changeset patch |
|
49 | # HG changeset patch | |
50 | # Date 1536771503 0 |
|
50 | # Date 1536771503 0 | |
51 | # Parent a5de21c9e3703f8e8eb064bd7d893ff2f703c66a |
|
51 | # Parent a5de21c9e3703f8e8eb064bd7d893ff2f703c66a | |
52 | exchangev2: start to implement pull with wire protocol v2 |
|
52 | exchangev2: start to implement pull with wire protocol v2 | |
53 |
|
53 | |||
54 | Wire protocol version 2 will take a substantially different |
|
54 | Wire protocol version 2 will take a substantially different | |
55 | approach to exchange than version 1 (at least as far as pulling |
|
55 | approach to exchange than version 1 (at least as far as pulling | |
56 | is concerned). |
|
56 | is concerned). | |
57 |
|
57 | |||
58 | This commit establishes a new exchangev2 module for holding |
|
58 | This commit establishes a new exchangev2 module for holding | |
59 |
|
59 | |||
60 | phabupdate with an accept: |
|
60 | phabupdate with an accept: | |
61 | $ hg phabupdate --accept D4564 \ |
|
61 | $ hg phabupdate --accept D4564 \ | |
62 | > -m 'I think I like where this is headed. Will read rest of series later.'\ |
|
62 | > -m 'I think I like where this is headed. Will read rest of series later.'\ | |
63 | > --test-vcr "$VCR/accept-4564.json" |
|
63 | > --test-vcr "$VCR/accept-4564.json" | |
64 | abort: Conduit Error (ERR-CONDUIT-CORE): Validation errors: |
|
64 | abort: Conduit Error (ERR-CONDUIT-CORE): Validation errors: | |
65 | - You can not accept this revision because it has already been closed. Only open revisions can be accepted. |
|
65 | - You can not accept this revision because it has already been closed. Only open revisions can be accepted. | |
66 | [255] |
|
66 | [255] | |
67 | $ hg phabupdate --accept D7913 -m 'LGTM' --test-vcr "$VCR/accept-7913.json" |
|
67 | $ hg phabupdate --accept D7913 -m 'LGTM' --test-vcr "$VCR/accept-7913.json" | |
68 |
|
68 | |||
69 | Create a differential diff: |
|
69 | Create a differential diff: | |
70 | $ HGENCODING=utf-8; export HGENCODING |
|
70 | $ HGENCODING=utf-8; export HGENCODING | |
71 | $ echo alpha > alpha |
|
71 | $ echo alpha > alpha | |
72 | $ hg ci --addremove -m 'create alpha for phabricator test β¬' |
|
72 | $ hg ci --addremove -m 'create alpha for phabricator test β¬' | |
73 | adding alpha |
|
73 | adding alpha | |
74 | $ hg phabsend -r . --test-vcr "$VCR/phabsend-create-alpha.json" |
|
74 | $ hg phabsend -r . --test-vcr "$VCR/phabsend-create-alpha.json" | |
75 | D7915 - created - d386117f30e6: create alpha for phabricator test \xe2\x82\xac (esc) |
|
75 | D7915 - created - d386117f30e6: create alpha for phabricator test \xe2\x82\xac (esc) | |
76 | saved backup bundle to $TESTTMP/repo/.hg/strip-backup/d386117f30e6-24ffe649-phabsend.hg |
|
76 | saved backup bundle to $TESTTMP/repo/.hg/strip-backup/d386117f30e6-24ffe649-phabsend.hg | |
77 | $ echo more >> alpha |
|
77 | $ echo more >> alpha | |
78 | $ HGEDITOR=true hg ci --amend |
|
78 | $ HGEDITOR=true hg ci --amend | |
79 | saved backup bundle to $TESTTMP/repo/.hg/strip-backup/347bf67801e5-3bf313e4-amend.hg |
|
79 | saved backup bundle to $TESTTMP/repo/.hg/strip-backup/347bf67801e5-3bf313e4-amend.hg | |
80 | $ echo beta > beta |
|
80 | $ echo beta > beta | |
81 | $ hg ci --addremove -m 'create beta for phabricator test' |
|
81 | $ hg ci --addremove -m 'create beta for phabricator test' | |
82 | adding beta |
|
82 | adding beta | |
83 | $ hg phabsend -r ".^::" --test-vcr "$VCR/phabsend-update-alpha-create-beta.json" |
|
83 | $ hg phabsend -r ".^::" --test-vcr "$VCR/phabsend-update-alpha-create-beta.json" | |
84 | D7915 - updated - c44b38f24a45: create alpha for phabricator test \xe2\x82\xac (esc) |
|
84 | D7915 - updated - c44b38f24a45: create alpha for phabricator test \xe2\x82\xac (esc) | |
85 | D7916 - created - 9e6901f21d5b: create beta for phabricator test |
|
85 | D7916 - created - 9e6901f21d5b: create beta for phabricator test | |
86 | saved backup bundle to $TESTTMP/repo/.hg/strip-backup/9e6901f21d5b-1fcd4f0e-phabsend.hg |
|
86 | saved backup bundle to $TESTTMP/repo/.hg/strip-backup/9e6901f21d5b-1fcd4f0e-phabsend.hg | |
87 | $ unset HGENCODING |
|
87 | $ unset HGENCODING | |
88 |
|
88 | |||
89 | The amend won't explode after posting a public commit. The local tag is left |
|
89 | The amend won't explode after posting a public commit. The local tag is left | |
90 | behind to identify it. |
|
90 | behind to identify it. | |
91 |
|
91 | |||
92 | $ echo 'public change' > beta |
|
92 | $ echo 'public change' > beta | |
93 | $ hg ci -m 'create public change for phabricator testing' |
|
93 | $ hg ci -m 'create public change for phabricator testing' | |
94 | $ hg phase --public . |
|
94 | $ hg phase --public . | |
95 | $ echo 'draft change' > alpha |
|
95 | $ echo 'draft change' > alpha | |
96 | $ hg ci -m 'create draft change for phabricator testing' |
|
96 | $ hg ci -m 'create draft change for phabricator testing' | |
97 | $ hg phabsend --amend -r '.^::' --test-vcr "$VCR/phabsend-create-public.json" |
|
97 | $ hg phabsend --amend -r '.^::' --test-vcr "$VCR/phabsend-create-public.json" | |
98 | D7917 - created - 7b4185ab5d16: create public change for phabricator testing |
|
98 | D7917 - created - 7b4185ab5d16: create public change for phabricator testing | |
99 | D7918 - created - 251c1c333fc6: create draft change for phabricator testing |
|
99 | D7918 - created - 251c1c333fc6: create draft change for phabricator testing | |
100 | warning: not updating public commit 2:7b4185ab5d16 |
|
100 | warning: not updating public commit 2:7b4185ab5d16 | |
101 | saved backup bundle to $TESTTMP/repo/.hg/strip-backup/251c1c333fc6-41cb7c3b-phabsend.hg |
|
101 | saved backup bundle to $TESTTMP/repo/.hg/strip-backup/251c1c333fc6-41cb7c3b-phabsend.hg | |
102 | $ hg tags -v |
|
102 | $ hg tags -v | |
103 | tip 3:3244dc4a3334 |
|
103 | tip 3:3244dc4a3334 | |
104 | D7917 2:7b4185ab5d16 local |
|
104 | D7917 2:7b4185ab5d16 local | |
105 |
|
105 | |||
106 | $ hg debugcallconduit user.search --test-vcr "$VCR/phab-conduit.json" <<EOF |
|
106 | $ hg debugcallconduit user.search --test-vcr "$VCR/phab-conduit.json" <<EOF | |
107 | > { |
|
107 | > { | |
108 | > "constraints": { |
|
108 | > "constraints": { | |
109 | > "isBot": true |
|
109 | > "isBot": true | |
110 | > } |
|
110 | > } | |
111 | > } |
|
111 | > } | |
112 | > EOF |
|
112 | > EOF | |
113 | { |
|
113 | { | |
114 | "cursor": { |
|
114 | "cursor": { | |
115 | "after": null, |
|
115 | "after": null, | |
116 | "before": null, |
|
116 | "before": null, | |
117 | "limit": 100, |
|
117 | "limit": 100, | |
118 | "order": null |
|
118 | "order": null | |
119 | }, |
|
119 | }, | |
120 | "data": [], |
|
120 | "data": [], | |
121 | "maps": {}, |
|
121 | "maps": {}, | |
122 | "query": { |
|
122 | "query": { | |
123 | "queryKey": null |
|
123 | "queryKey": null | |
124 | } |
|
124 | } | |
125 | } |
|
125 | } | |
126 |
|
126 | |||
127 | Template keywords |
|
127 | Template keywords | |
128 | $ hg log -T'{rev} {phabreview|json}\n' |
|
128 | $ hg log -T'{rev} {phabreview|json}\n' | |
129 | 3 {"id": "D7918", "url": "https://phab.mercurial-scm.org/D7918"} |
|
129 | 3 {"id": "D7918", "url": "https://phab.mercurial-scm.org/D7918"} | |
130 | 2 {"id": "D7917", "url": "https://phab.mercurial-scm.org/D7917"} |
|
130 | 2 {"id": "D7917", "url": "https://phab.mercurial-scm.org/D7917"} | |
131 | 1 {"id": "D7916", "url": "https://phab.mercurial-scm.org/D7916"} |
|
131 | 1 {"id": "D7916", "url": "https://phab.mercurial-scm.org/D7916"} | |
132 | 0 {"id": "D7915", "url": "https://phab.mercurial-scm.org/D7915"} |
|
132 | 0 {"id": "D7915", "url": "https://phab.mercurial-scm.org/D7915"} | |
133 |
|
133 | |||
134 | $ hg log -T'{rev} {if(phabreview, "{phabreview.url} {phabreview.id}")}\n' |
|
134 | $ hg log -T'{rev} {if(phabreview, "{phabreview.url} {phabreview.id}")}\n' | |
135 | 3 https://phab.mercurial-scm.org/D7918 D7918 |
|
135 | 3 https://phab.mercurial-scm.org/D7918 D7918 | |
136 | 2 https://phab.mercurial-scm.org/D7917 D7917 |
|
136 | 2 https://phab.mercurial-scm.org/D7917 D7917 | |
137 | 1 https://phab.mercurial-scm.org/D7916 D7916 |
|
137 | 1 https://phab.mercurial-scm.org/D7916 D7916 | |
138 | 0 https://phab.mercurial-scm.org/D7915 D7915 |
|
138 | 0 https://phab.mercurial-scm.org/D7915 D7915 | |
139 |
|
139 | |||
140 | Commenting when phabsending: |
|
140 | Commenting when phabsending: | |
141 | $ echo comment > comment |
|
141 | $ echo comment > comment | |
142 | $ hg ci --addremove -m "create comment for phabricator test" |
|
142 | $ hg ci --addremove -m "create comment for phabricator test" | |
143 | adding comment |
|
143 | adding comment | |
144 | $ hg phabsend -r . -m "For default branch" --test-vcr "$VCR/phabsend-comment-created.json" |
|
144 | $ hg phabsend -r . -m "For default branch" --test-vcr "$VCR/phabsend-comment-created.json" | |
145 | D7919 - created - d5dddca9023d: create comment for phabricator test |
|
145 | D7919 - created - d5dddca9023d: create comment for phabricator test | |
146 | saved backup bundle to $TESTTMP/repo/.hg/strip-backup/d5dddca9023d-adf673ba-phabsend.hg |
|
146 | saved backup bundle to $TESTTMP/repo/.hg/strip-backup/d5dddca9023d-adf673ba-phabsend.hg | |
147 | $ echo comment2 >> comment |
|
147 | $ echo comment2 >> comment | |
148 | $ hg ci --amend |
|
148 | $ hg ci --amend | |
149 | saved backup bundle to $TESTTMP/repo/.hg/strip-backup/f7db812bbe1d-8fcded77-amend.hg |
|
149 | saved backup bundle to $TESTTMP/repo/.hg/strip-backup/f7db812bbe1d-8fcded77-amend.hg | |
150 | $ hg phabsend -r . -m "Address review comments" --test-vcr "$VCR/phabsend-comment-updated.json" |
|
150 | $ hg phabsend -r . -m "Address review comments" --test-vcr "$VCR/phabsend-comment-updated.json" | |
151 | D7919 - updated - 1849d7828727: create comment for phabricator test |
|
151 | D7919 - updated - 1849d7828727: create comment for phabricator test | |
152 |
|
152 | |||
153 | Phabsending a skipped commit: |
|
153 | Phabsending a skipped commit: | |
154 | $ hg phabsend --no-amend -r . --test-vcr "$VCR/phabsend-skipped.json" |
|
154 | $ hg phabsend --no-amend -r . --test-vcr "$VCR/phabsend-skipped.json" | |
155 | D7919 - skipped - 1849d7828727: create comment for phabricator test |
|
155 | D7919 - skipped - 1849d7828727: create comment for phabricator test | |
156 |
|
156 | |||
157 | Phabesending a new binary, a modified binary, and a removed binary |
|
157 | Phabesending a new binary, a modified binary, and a removed binary | |
158 |
|
158 | |||
159 | >>> open('bin', 'wb').write(b'\0a') and None |
|
159 | >>> open('bin', 'wb').write(b'\0a') and None | |
160 | $ hg ci -Am 'add binary' |
|
160 | $ hg ci -Am 'add binary' | |
161 | adding bin |
|
161 | adding bin | |
162 | >>> open('bin', 'wb').write(b'\0b') and None |
|
162 | >>> open('bin', 'wb').write(b'\0b') and None | |
163 | $ hg ci -m 'modify binary' |
|
163 | $ hg ci -m 'modify binary' | |
164 | $ hg rm bin |
|
164 | $ hg rm bin | |
165 | $ hg ci -m 'remove binary' |
|
165 | $ hg ci -m 'remove binary' | |
166 | $ hg phabsend -r .~2:: --test-vcr "$VCR/phabsend-binary.json" |
|
166 | $ hg phabsend -r .~2:: --test-vcr "$VCR/phabsend-binary.json" | |
167 | uploading bin@aa24a81f55de |
|
167 | uploading bin@aa24a81f55de | |
168 | D8007 - created - aa24a81f55de: add binary |
|
168 | D8007 - created - aa24a81f55de: add binary | |
169 | uploading bin@d8d62a881b54 |
|
169 | uploading bin@d8d62a881b54 | |
170 | D8008 - created - d8d62a881b54: modify binary |
|
170 | D8008 - created - d8d62a881b54: modify binary | |
171 | D8009 - created - af55645b2e29: remove binary |
|
171 | D8009 - created - af55645b2e29: remove binary | |
172 | saved backup bundle to $TESTTMP/repo/.hg/strip-backup/aa24a81f55de-a3a0cf24-phabsend.hg |
|
172 | saved backup bundle to $TESTTMP/repo/.hg/strip-backup/aa24a81f55de-a3a0cf24-phabsend.hg | |
173 |
|
173 | |||
174 | Phabsend a renamed binary and a copied binary, with and without content changes |
|
174 | Phabsend a renamed binary and a copied binary, with and without content changes | |
175 | to src and dest |
|
175 | to src and dest | |
176 |
|
176 | |||
177 | >>> open('bin2', 'wb').write(b'\0c') and None |
|
177 | >>> open('bin2', 'wb').write(b'\0c') and None | |
178 | $ hg ci -Am 'add another binary' |
|
178 | $ hg ci -Am 'add another binary' | |
179 | adding bin2 |
|
179 | adding bin2 | |
180 |
|
180 | |||
181 | TODO: "bin2" can't be viewed in this commit (left or right side), and the URL |
|
181 | TODO: "bin2" can't be viewed in this commit (left or right side), and the URL | |
182 | looks much different than when viewing "bin2_moved". No idea if this is a phab |
|
182 | looks much different than when viewing "bin2_moved". No idea if this is a phab | |
183 | bug, or phabsend bug. The patch (as printed by phabread) look reasonable |
|
183 | bug, or phabsend bug. The patch (as printed by phabread) look reasonable | |
184 | though. |
|
184 | though. | |
185 |
|
185 | |||
186 | $ hg mv bin2 bin2_moved |
|
186 | $ hg mv bin2 bin2_moved | |
187 | $ hg ci -m "moved binary" |
|
187 | $ hg ci -m "moved binary" | |
188 |
|
188 | |||
189 | Note: "bin2_moved" is also not viewable in phabricator with this review |
|
189 | Note: "bin2_moved" is also not viewable in phabricator with this review | |
190 |
|
190 | |||
191 | $ hg cp bin2_moved bin2_copied |
|
191 | $ hg cp bin2_moved bin2_copied | |
192 | $ hg ci -m "copied binary" |
|
192 | $ hg ci -m "copied binary" | |
193 |
|
193 | |||
194 | Note: "bin2_moved_again" is marked binary in phabricator, and both sides of it |
|
194 | Note: "bin2_moved_again" is marked binary in phabricator, and both sides of it | |
195 | are viewable in their proper state. "bin2_copied" is not viewable, and not |
|
195 | are viewable in their proper state. "bin2_copied" is not viewable, and not | |
196 | listed as binary in phabricator. |
|
196 | listed as binary in phabricator. | |
197 |
|
197 | |||
198 | >>> open('bin2_copied', 'wb').write(b'\0move+mod') and None |
|
198 | >>> open('bin2_copied', 'wb').write(b'\0move+mod') and None | |
199 | $ hg mv bin2_copied bin2_moved_again |
|
199 | $ hg mv bin2_copied bin2_moved_again | |
200 | $ hg ci -m "move+mod copied binary" |
|
200 | $ hg ci -m "move+mod copied binary" | |
201 |
|
201 | |||
202 | Note: "bin2_moved" and "bin2_moved_copy" are both marked binary, and both |
|
202 | Note: "bin2_moved" and "bin2_moved_copy" are both marked binary, and both | |
203 | viewable on each side. |
|
203 | viewable on each side. | |
204 |
|
204 | |||
205 | >>> open('bin2_moved', 'wb').write(b'\0precopy mod') and None |
|
205 | >>> open('bin2_moved', 'wb').write(b'\0precopy mod') and None | |
206 | $ hg cp bin2_moved bin2_moved_copied |
|
206 | $ hg cp bin2_moved bin2_moved_copied | |
207 | >>> open('bin2_moved', 'wb').write(b'\0copy src+mod') and None |
|
207 | >>> open('bin2_moved', 'wb').write(b'\0copy src+mod') and None | |
208 | $ hg ci -m "copy+mod moved binary" |
|
208 | $ hg ci -m "copy+mod moved binary" | |
209 |
|
209 | |||
210 | $ hg phabsend -r .~4:: --test-vcr "$VCR/phabsend-binary-renames.json" |
|
210 | $ hg phabsend -r .~4:: --test-vcr "$VCR/phabsend-binary-renames.json" | |
211 | uploading bin2@f42f9195e00c |
|
211 | uploading bin2@f42f9195e00c | |
212 | D8128 - created - f42f9195e00c: add another binary |
|
212 | D8128 - created - f42f9195e00c: add another binary | |
213 | D8129 - created - 834ab31d80ae: moved binary |
|
213 | D8129 - created - 834ab31d80ae: moved binary | |
214 | D8130 - created - 494b750e5194: copied binary |
|
214 | D8130 - created - 494b750e5194: copied binary | |
215 | uploading bin2_moved_again@25f766b50cc2 |
|
215 | uploading bin2_moved_again@25f766b50cc2 | |
216 | D8131 - created - 25f766b50cc2: move+mod copied binary |
|
216 | D8131 - created - 25f766b50cc2: move+mod copied binary | |
217 | uploading bin2_moved_copied@1b87b363a5e4 |
|
217 | uploading bin2_moved_copied@1b87b363a5e4 | |
218 | uploading bin2_moved@1b87b363a5e4 |
|
218 | uploading bin2_moved@1b87b363a5e4 | |
219 | D8132 - created - 1b87b363a5e4: copy+mod moved binary |
|
219 | D8132 - created - 1b87b363a5e4: copy+mod moved binary | |
220 | saved backup bundle to $TESTTMP/repo/.hg/strip-backup/f42f9195e00c-e82a0769-phabsend.hg |
|
220 | saved backup bundle to $TESTTMP/repo/.hg/strip-backup/f42f9195e00c-e82a0769-phabsend.hg | |
221 |
|
221 | |||
222 | Phabreading a DREV with a local:commits time as a string: |
|
222 | Phabreading a DREV with a local:commits time as a string: | |
223 | $ hg phabread --test-vcr "$VCR/phabread-str-time.json" D1285 |
|
223 | $ hg phabread --test-vcr "$VCR/phabread-str-time.json" D1285 | |
224 | # HG changeset patch |
|
224 | # HG changeset patch | |
225 | # User Pulkit Goyal <7895pulkit@gmail.com> |
|
225 | # User Pulkit Goyal <7895pulkit@gmail.com> | |
226 | # Date 1509404054 -19800 |
|
226 | # Date 1509404054 -19800 | |
227 | # Node ID 44fc1c1f1774a76423b9c732af6938435099bcc5 |
|
227 | # Node ID 44fc1c1f1774a76423b9c732af6938435099bcc5 | |
228 | # Parent 8feef8ef8389a3b544e0a74624f1efc3a8d85d35 |
|
228 | # Parent 8feef8ef8389a3b544e0a74624f1efc3a8d85d35 | |
229 | repoview: add a new attribute _visibilityexceptions and related API |
|
229 | repoview: add a new attribute _visibilityexceptions and related API | |
230 |
|
230 | |||
231 | Currently we don't have a defined way in core to make some hidden revisions |
|
231 | Currently we don't have a defined way in core to make some hidden revisions | |
232 | visible in filtered repo. Extensions to achieve the purpose of unhiding some |
|
232 | visible in filtered repo. Extensions to achieve the purpose of unhiding some | |
233 | hidden commits, wrap repoview.pinnedrevs() function. |
|
233 | hidden commits, wrap repoview.pinnedrevs() function. | |
234 |
|
234 | |||
235 | To make the above task simple and have well defined API, this patch adds a new |
|
235 | To make the above task simple and have well defined API, this patch adds a new | |
236 | attribute '_visibilityexceptions' to repoview class which will contains |
|
236 | attribute '_visibilityexceptions' to repoview class which will contains | |
237 | the hidden revs which should be exception. |
|
237 | the hidden revs which should be exception. | |
238 | This will allow to set different exceptions for different repoview objects |
|
238 | This will allow to set different exceptions for different repoview objects | |
239 | backed by the same unfiltered repo. |
|
239 | backed by the same unfiltered repo. | |
240 |
|
240 | |||
241 | This patch also adds API to add revs to the attribute set and get them. |
|
241 | This patch also adds API to add revs to the attribute set and get them. | |
242 |
|
242 | |||
243 | Thanks to Jun for suggesting the use of repoview class instead of localrepo. |
|
243 | Thanks to Jun for suggesting the use of repoview class instead of localrepo. | |
244 |
|
244 | |||
245 | Differential Revision: https://phab.mercurial-scm.org/D1285 |
|
245 | Differential Revision: https://phab.mercurial-scm.org/D1285 | |
246 | diff --git a/mercurial/repoview.py b/mercurial/repoview.py |
|
246 | diff --git a/mercurial/repoview.py b/mercurial/repoview.py | |
247 | --- a/mercurial/repoview.py |
|
247 | --- a/mercurial/repoview.py | |
248 | +++ b/mercurial/repoview.py |
|
248 | +++ b/mercurial/repoview.py | |
249 | @@ * @@ (glob) |
|
249 | @@ * @@ (glob) | |
250 | subclasses of `localrepo`. Eg: `bundlerepo` or `statichttprepo`. |
|
250 | subclasses of `localrepo`. Eg: `bundlerepo` or `statichttprepo`. | |
251 | """ |
|
251 | """ | |
252 |
|
252 | |||
253 | + # hidden revs which should be visible |
|
253 | + # hidden revs which should be visible | |
254 | + _visibilityexceptions = set() |
|
254 | + _visibilityexceptions = set() | |
255 | + |
|
255 | + | |
256 | def __init__(self, repo, filtername): |
|
256 | def __init__(self, repo, filtername): | |
257 | object.__setattr__(self, r'_unfilteredrepo', repo) |
|
257 | object.__setattr__(self, r'_unfilteredrepo', repo) | |
258 | object.__setattr__(self, r'filtername', filtername) |
|
258 | object.__setattr__(self, r'filtername', filtername) | |
259 | @@ -231,6 +234,14 @@ |
|
259 | @@ -231,6 +234,14 @@ | |
260 | return self |
|
260 | return self | |
261 | return self.unfiltered().filtered(name) |
|
261 | return self.unfiltered().filtered(name) | |
262 |
|
262 | |||
263 | + def addvisibilityexceptions(self, revs): |
|
263 | + def addvisibilityexceptions(self, revs): | |
264 | + """adds hidden revs which should be visible to set of exceptions""" |
|
264 | + """adds hidden revs which should be visible to set of exceptions""" | |
265 | + self._visibilityexceptions.update(revs) |
|
265 | + self._visibilityexceptions.update(revs) | |
266 | + |
|
266 | + | |
267 | + def getvisibilityexceptions(self): |
|
267 | + def getvisibilityexceptions(self): | |
268 | + """returns the set of hidden revs which should be visible""" |
|
268 | + """returns the set of hidden revs which should be visible""" | |
269 | + return self._visibilityexceptions |
|
269 | + return self._visibilityexceptions | |
270 | + |
|
270 | + | |
271 | # everything access are forwarded to the proxied repo |
|
271 | # everything access are forwarded to the proxied repo | |
272 | def __getattr__(self, attr): |
|
272 | def __getattr__(self, attr): | |
273 | return getattr(self._unfilteredrepo, attr) |
|
273 | return getattr(self._unfilteredrepo, attr) | |
274 | diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py |
|
274 | diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py | |
275 | --- a/mercurial/localrepo.py |
|
275 | --- a/mercurial/localrepo.py | |
276 | +++ b/mercurial/localrepo.py |
|
276 | +++ b/mercurial/localrepo.py | |
277 | @@ -570,6 +570,14 @@ |
|
277 | @@ -570,6 +570,14 @@ | |
278 | def close(self): |
|
278 | def close(self): | |
279 | self._writecaches() |
|
279 | self._writecaches() | |
280 |
|
280 | |||
281 | + def addvisibilityexceptions(self, exceptions): |
|
281 | + def addvisibilityexceptions(self, exceptions): | |
282 | + # should be called on a filtered repository |
|
282 | + # should be called on a filtered repository | |
283 | + pass |
|
283 | + pass | |
284 | + |
|
284 | + | |
285 | + def getvisibilityexceptions(self): |
|
285 | + def getvisibilityexceptions(self): | |
286 | + # should be called on a filtered repository |
|
286 | + # should be called on a filtered repository | |
287 | + return set() |
|
287 | + return set() | |
288 | + |
|
288 | + | |
289 | def _loadextensions(self): |
|
289 | def _loadextensions(self): | |
290 | extensions.loadall(self.ui) |
|
290 | extensions.loadall(self.ui) | |
291 |
|
291 | |||
292 |
|
292 | |||
293 | A bad .arcconfig doesn't error out |
|
293 | A bad .arcconfig doesn't error out | |
294 | $ echo 'garbage' > .arcconfig |
|
294 | $ echo 'garbage' > .arcconfig | |
295 | $ hg config phabricator --debug |
|
295 | $ hg config phabricator --debug | |
296 | invalid JSON in $TESTTMP/repo/.arcconfig |
|
296 | invalid JSON in $TESTTMP/repo/.arcconfig | |
297 | read config from: */.hgrc (glob) |
|
297 | read config from: */.hgrc (glob) | |
298 | $TESTTMP/repo/.hg/hgrc:*: phabricator.url=https://phab.mercurial-scm.org/ (glob) |
|
298 | $TESTTMP/repo/.hg/hgrc:*: phabricator.url=https://phab.mercurial-scm.org/ (glob) | |
299 | $TESTTMP/repo/.hg/hgrc:*: phabricator.callsign=HG (glob) |
|
299 | $TESTTMP/repo/.hg/hgrc:*: phabricator.callsign=HG (glob) | |
300 |
|
300 | |||
301 | The .arcconfig content overrides global config |
|
301 | The .arcconfig content overrides global config | |
302 | $ cat >> $HGRCPATH << EOF |
|
302 | $ cat >> $HGRCPATH << EOF | |
303 | > [phabricator] |
|
303 | > [phabricator] | |
304 | > url = global |
|
304 | > url = global | |
305 | > callsign = global |
|
305 | > callsign = global | |
306 | > EOF |
|
306 | > EOF | |
307 | $ cp $TESTDIR/../.arcconfig . |
|
307 | $ cp $TESTDIR/../.arcconfig . | |
308 | $ mv .hg/hgrc .hg/hgrc.bak |
|
308 | $ mv .hg/hgrc .hg/hgrc.bak | |
309 | $ hg config phabricator --debug |
|
309 | $ hg config phabricator --debug | |
310 | read config from: */.hgrc (glob) |
|
310 | read config from: */.hgrc (glob) | |
311 | $TESTTMP/repo/.arcconfig: phabricator.callsign=HG |
|
311 | $TESTTMP/repo/.arcconfig: phabricator.callsign=HG | |
312 | $TESTTMP/repo/.arcconfig: phabricator.url=https://phab.mercurial-scm.org/ |
|
312 | $TESTTMP/repo/.arcconfig: phabricator.url=https://phab.mercurial-scm.org/ | |
313 |
|
313 | |||
314 | But it doesn't override local config |
|
314 | But it doesn't override local config | |
315 | $ cat >> .hg/hgrc << EOF |
|
315 | $ cat >> .hg/hgrc << EOF | |
316 | > [phabricator] |
|
316 | > [phabricator] | |
317 | > url = local |
|
317 | > url = local | |
318 | > callsign = local |
|
318 | > callsign = local | |
319 | > EOF |
|
319 | > EOF | |
320 | $ hg config phabricator --debug |
|
320 | $ hg config phabricator --debug | |
321 | read config from: */.hgrc (glob) |
|
321 | read config from: */.hgrc (glob) | |
322 | $TESTTMP/repo/.hg/hgrc:*: phabricator.url=local (glob) |
|
322 | $TESTTMP/repo/.hg/hgrc:*: phabricator.url=local (glob) | |
323 | $TESTTMP/repo/.hg/hgrc:*: phabricator.callsign=local (glob) |
|
323 | $TESTTMP/repo/.hg/hgrc:*: phabricator.callsign=local (glob) | |
324 | $ mv .hg/hgrc.bak .hg/hgrc |
|
324 | $ mv .hg/hgrc.bak .hg/hgrc | |
325 |
|
325 | |||
326 | Phabimport works with a stack |
|
326 | Phabimport works with a stack | |
327 |
|
327 | |||
328 | $ cd .. |
|
328 | $ cd .. | |
329 | $ hg clone repo repo2 -qr 1 |
|
329 | $ hg clone repo repo2 -qr 1 | |
330 | $ cp repo/.hg/hgrc repo2/.hg/ |
|
330 | $ cp repo/.hg/hgrc repo2/.hg/ | |
331 | $ cd repo2 |
|
331 | $ cd repo2 | |
332 | $ hg phabimport --stack 'D7918' --test-vcr "$VCR/phabimport-stack.json" |
|
332 | $ hg phabimport --stack 'D7918' --test-vcr "$VCR/phabimport-stack.json" | |
333 | applying patch from D7917 |
|
333 | applying patch from D7917 | |
334 | applying patch from D7918 |
|
334 | applying patch from D7918 | |
335 | $ hg log -G -Tcompact |
|
335 | $ hg log -r .: -G -Tcompact | |
336 | o 3[tip] aaef04066140 1970-01-01 00:00 +0000 test |
|
336 | o 3[tip] aaef04066140 1970-01-01 00:00 +0000 test | |
337 | | create draft change for phabricator testing |
|
337 | | create draft change for phabricator testing | |
338 | | |
|
338 | | | |
339 | o 2 8de3712202d1 1970-01-01 00:00 +0000 test |
|
339 | o 2 8de3712202d1 1970-01-01 00:00 +0000 test | |
340 | | create public change for phabricator testing |
|
340 | | create public change for phabricator testing | |
341 | | |
|
341 | | | |
342 | @ 1 a692622e6937 1970-01-01 00:00 +0000 test |
|
342 | @ 1 a692622e6937 1970-01-01 00:00 +0000 test | |
343 | | create beta for phabricator test |
|
343 | | create beta for phabricator test | |
344 |
|
|
344 | ~ | |
345 | o 0 c44b38f24a45 1970-01-01 00:00 +0000 test |
|
|||
346 | create alpha for phabricator test \x80 (esc) |
|
|||
347 |
|
||||
348 |
|
|
345 | Phabimport can create secret commits | |
349 |
|
346 | |||
350 | $ hg rollback --config ui.rollback=True |
|
347 | $ hg rollback --config ui.rollback=True | |
351 | repository tip rolled back to revision 1 (undo phabimport) |
|
348 | repository tip rolled back to revision 1 (undo phabimport) | |
352 | $ hg phabimport --stack 'D7918' --test-vcr "$VCR/phabimport-stack.json" \ |
|
349 | $ hg phabimport --stack 'D7918' --test-vcr "$VCR/phabimport-stack.json" \ | |
353 | > --config phabimport.secret=True |
|
350 | > --config phabimport.secret=True | |
354 | applying patch from D7917 |
|
351 | applying patch from D7917 | |
355 | applying patch from D7918 |
|
352 | applying patch from D7918 | |
356 | $ hg log -T phases |
|
353 | $ hg log -r 'reverse(.:)' -T phases | |
357 | changeset: 3:aaef04066140 |
|
354 | changeset: 3:aaef04066140 | |
358 | tag: tip |
|
355 | tag: tip | |
359 | phase: secret |
|
356 | phase: secret | |
360 | user: test |
|
357 | user: test | |
361 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
358 | date: Thu Jan 01 00:00:00 1970 +0000 | |
362 | summary: create draft change for phabricator testing |
|
359 | summary: create draft change for phabricator testing | |
363 |
|
360 | |||
364 | changeset: 2:8de3712202d1 |
|
361 | changeset: 2:8de3712202d1 | |
365 | phase: secret |
|
362 | phase: secret | |
366 | user: test |
|
363 | user: test | |
367 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
364 | date: Thu Jan 01 00:00:00 1970 +0000 | |
368 | summary: create public change for phabricator testing |
|
365 | summary: create public change for phabricator testing | |
369 |
|
366 | |||
370 | changeset: 1:a692622e6937 |
|
367 | changeset: 1:a692622e6937 | |
371 | phase: public |
|
368 | phase: public | |
372 | user: test |
|
369 | user: test | |
373 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
370 | date: Thu Jan 01 00:00:00 1970 +0000 | |
374 | summary: create beta for phabricator test |
|
371 | summary: create beta for phabricator test | |
375 |
|
372 | |||
376 | changeset: 0:c44b38f24a45 |
|
|||
377 | phase: public |
|
|||
378 | user: test |
|
|||
379 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
|||
380 | summary: create alpha for phabricator test \x80 (esc) |
|
|||
381 |
|
||||
382 |
|
373 | |||
383 | $ cd .. |
|
374 | $ cd .. |
General Comments 0
You need to be logged in to leave comments.
Login now