equal
deleted
inserted
replaced
18 Config:: |
18 Config:: |
19 |
19 |
20 [phabricator] |
20 [phabricator] |
21 # Phabricator URL |
21 # Phabricator URL |
22 url = https://phab.example.com/ |
22 url = https://phab.example.com/ |
23 |
|
24 # API token. Get it from https://$HOST/conduit/login/ |
|
25 # Deprecated: see [phabricator.auth] below |
|
26 #token = cli-xxxxxxxxxxxxxxxxxxxxxxxxxxxx |
|
27 |
23 |
28 # Repo callsign. If a repo has a URL https://$HOST/diffusion/FOO, then its |
24 # Repo callsign. If a repo has a URL https://$HOST/diffusion/FOO, then its |
29 # callsign is "FOO". |
25 # callsign is "FOO". |
30 callsign = FOO |
26 callsign = FOO |
31 |
27 |
102 else: |
98 else: |
103 process(k, v) |
99 process(k, v) |
104 process('', params) |
100 process('', params) |
105 return util.urlreq.urlencode(flatparams) |
101 return util.urlreq.urlencode(flatparams) |
106 |
102 |
107 printed_token_warning = False |
|
108 |
|
109 def readlegacytoken(repo): |
|
110 """Transitional support for old phabricator tokens. |
|
111 |
|
112 Remove before the 4.6 release. |
|
113 """ |
|
114 global printed_token_warning |
|
115 token = repo.ui.config('phabricator', 'token') |
|
116 if token and not printed_token_warning: |
|
117 printed_token_warning = True |
|
118 repo.ui.warn(_('phabricator.token is deprecated - please ' |
|
119 'migrate to the phabricator.auth section.\n')) |
|
120 return token |
|
121 |
|
122 def readurltoken(repo): |
103 def readurltoken(repo): |
123 """return conduit url, token and make sure they exist |
104 """return conduit url, token and make sure they exist |
124 |
105 |
125 Currently read from [phabricator] config section. In the future, it might |
106 Currently read from [phabricator] config section. In the future, it might |
126 make sense to read from .arcconfig and .arcrc as well. |
107 make sense to read from .arcconfig and .arcrc as well. |
146 token = auth.get('token') |
127 token = auth.get('token') |
147 if token: |
128 if token: |
148 break |
129 break |
149 |
130 |
150 if not token: |
131 if not token: |
151 token = readlegacytoken(repo) |
132 raise error.Abort(_('Can\'t find conduit token associated to %s') |
152 if not token: |
133 % (url,)) |
153 raise error.Abort(_('Can\'t find conduit token associated to %s') |
|
154 % (url,)) |
|
155 |
134 |
156 return url, token |
135 return url, token |
157 |
136 |
158 def callconduit(repo, name, params): |
137 def callconduit(repo, name, params): |
159 """call Conduit API, params is a dict. return json.loads result, or None""" |
138 """call Conduit API, params is a dict. return json.loads result, or None""" |