99 |
100 |
100 cmdtable = eh.cmdtable |
101 cmdtable = eh.cmdtable |
101 command = eh.command |
102 command = eh.command |
102 configtable = eh.configtable |
103 configtable = eh.configtable |
103 templatekeyword = eh.templatekeyword |
104 templatekeyword = eh.templatekeyword |
|
105 uisetup = eh.finaluisetup |
104 |
106 |
105 # developer config: phabricator.batchsize |
107 # developer config: phabricator.batchsize |
106 eh.configitem( |
108 eh.configitem( |
107 b'phabricator', b'batchsize', default=12, |
109 b'phabricator', b'batchsize', default=12, |
108 ) |
110 ) |
148 b', otherwise will mock all http requests using the specified vcr file.' |
150 b', otherwise will mock all http requests using the specified vcr file.' |
149 b' (ADVANCED)' |
151 b' (ADVANCED)' |
150 ), |
152 ), |
151 ), |
153 ), |
152 ] |
154 ] |
|
155 |
|
156 |
|
157 @eh.wrapfunction(localrepo, "loadhgrc") |
|
158 def _loadhgrc(orig, ui, wdirvfs, hgvfs, requirements): |
|
159 """Load ``.arcconfig`` content into a ui instance on repository open. |
|
160 """ |
|
161 result = False |
|
162 arcconfig = {} |
|
163 |
|
164 try: |
|
165 # json.loads only accepts bytes from 3.6+ |
|
166 rawparams = encoding.unifromlocal(wdirvfs.read(b".arcconfig")) |
|
167 # json.loads only returns unicode strings |
|
168 arcconfig = pycompat.rapply( |
|
169 lambda x: encoding.unitolocal(x) |
|
170 if isinstance(x, pycompat.unicode) |
|
171 else x, |
|
172 pycompat.json_loads(rawparams), |
|
173 ) |
|
174 |
|
175 result = True |
|
176 except ValueError: |
|
177 ui.warn(_(b"invalid JSON in %s\n") % wdirvfs.join(b".arcconfig")) |
|
178 except IOError: |
|
179 pass |
|
180 |
|
181 if b"repository.callsign" in arcconfig: |
|
182 ui.applyconfig( |
|
183 {(b"phabricator", b"callsign"): arcconfig[b"repository.callsign"]}, |
|
184 source=wdirvfs.join(b".arcconfig"), |
|
185 ) |
|
186 |
|
187 return orig(ui, wdirvfs, hgvfs, requirements) or result # Load .hg/hgrc |
153 |
188 |
154 |
189 |
155 def vcrcommand(name, flags, spec, helpcategory=None, optionalrepo=False): |
190 def vcrcommand(name, flags, spec, helpcategory=None, optionalrepo=False): |
156 fullflags = flags + _VCR_FLAGS |
191 fullflags = flags + _VCR_FLAGS |
157 |
192 |