Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/unionrepo.py @ 43077:687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Done with
python3.7 contrib/byteify-strings.py -i $(hg files 'set:mercurial/**.py - mercurial/thirdparty/** + hgext/**.py - hgext/fsmonitor/pywatchman/** - mercurial/__init__.py')
black -l 80 -t py33 -S $(hg files 'set:**.py - mercurial/thirdparty/** - "contrib/python-zstandard/**" - hgext/fsmonitor/pywatchman/**')
# skip-blame mass-reformatting only
Differential Revision: https://phab.mercurial-scm.org/D6972
author | Augie Fackler <augie@google.com> |
---|---|
date | Sun, 06 Oct 2019 09:48:39 -0400 |
parents | 2372284d9457 |
children | c59eb1560c44 |
comparison
equal
deleted
inserted
replaced
43076:2372284d9457 | 43077:687b865b95ad |
---|---|
191 | 191 |
192 def __init__(self, repo2, url): | 192 def __init__(self, repo2, url): |
193 self.repo2 = repo2 | 193 self.repo2 = repo2 |
194 self._url = url | 194 self._url = url |
195 | 195 |
196 self.ui.setconfig('phases', 'publish', False, 'unionrepo') | 196 self.ui.setconfig(b'phases', b'publish', False, b'unionrepo') |
197 | 197 |
198 @localrepo.unfilteredpropertycache | 198 @localrepo.unfilteredpropertycache |
199 def changelog(self): | 199 def changelog(self): |
200 return unionchangelog(self.svfs, self.repo2.svfs) | 200 return unionchangelog(self.svfs, self.repo2.svfs) |
201 | 201 |
234 return encoding.getcwd() # always outside the repo | 234 return encoding.getcwd() # always outside the repo |
235 | 235 |
236 | 236 |
237 def instance(ui, path, create, intents=None, createopts=None): | 237 def instance(ui, path, create, intents=None, createopts=None): |
238 if create: | 238 if create: |
239 raise error.Abort(_('cannot create new union repository')) | 239 raise error.Abort(_(b'cannot create new union repository')) |
240 parentpath = ui.config("bundle", "mainreporoot") | 240 parentpath = ui.config(b"bundle", b"mainreporoot") |
241 if not parentpath: | 241 if not parentpath: |
242 # try to find the correct path to the working directory repo | 242 # try to find the correct path to the working directory repo |
243 parentpath = cmdutil.findrepo(encoding.getcwd()) | 243 parentpath = cmdutil.findrepo(encoding.getcwd()) |
244 if parentpath is None: | 244 if parentpath is None: |
245 parentpath = '' | 245 parentpath = b'' |
246 if parentpath: | 246 if parentpath: |
247 # Try to make the full path relative so we get a nice, short URL. | 247 # Try to make the full path relative so we get a nice, short URL. |
248 # In particular, we don't want temp dir names in test outputs. | 248 # In particular, we don't want temp dir names in test outputs. |
249 cwd = encoding.getcwd() | 249 cwd = encoding.getcwd() |
250 if parentpath == cwd: | 250 if parentpath == cwd: |
251 parentpath = '' | 251 parentpath = b'' |
252 else: | 252 else: |
253 cwd = pathutil.normasprefix(cwd) | 253 cwd = pathutil.normasprefix(cwd) |
254 if parentpath.startswith(cwd): | 254 if parentpath.startswith(cwd): |
255 parentpath = parentpath[len(cwd) :] | 255 parentpath = parentpath[len(cwd) :] |
256 if path.startswith('union:'): | 256 if path.startswith(b'union:'): |
257 s = path.split(":", 1)[1].split("+", 1) | 257 s = path.split(b":", 1)[1].split(b"+", 1) |
258 if len(s) == 1: | 258 if len(s) == 1: |
259 repopath, repopath2 = parentpath, s[0] | 259 repopath, repopath2 = parentpath, s[0] |
260 else: | 260 else: |
261 repopath, repopath2 = s | 261 repopath, repopath2 = s |
262 else: | 262 else: |
268 def makeunionrepository(ui, repopath1, repopath2): | 268 def makeunionrepository(ui, repopath1, repopath2): |
269 """Make a union repository object from 2 local repo paths.""" | 269 """Make a union repository object from 2 local repo paths.""" |
270 repo1 = localrepo.instance(ui, repopath1, create=False) | 270 repo1 = localrepo.instance(ui, repopath1, create=False) |
271 repo2 = localrepo.instance(ui, repopath2, create=False) | 271 repo2 = localrepo.instance(ui, repopath2, create=False) |
272 | 272 |
273 url = 'union:%s+%s' % ( | 273 url = b'union:%s+%s' % ( |
274 util.expandpath(repopath1), | 274 util.expandpath(repopath1), |
275 util.expandpath(repopath2), | 275 util.expandpath(repopath2), |
276 ) | 276 ) |
277 | 277 |
278 class derivedunionrepository(unionrepository, repo1.__class__): | 278 class derivedunionrepository(unionrepository, repo1.__class__): |