comparison mercurial/localrepo.py @ 37717:0664be4f0c1f

hg: pass command intents to repo/peer creation (API) The previous commit introduced a mechanism to declare command intents. This commit changes the repository and peer instantiation mechanism so the intents are passed down to each repository and peer type so they can do with them whatever they please. Currently, nobody does anything with any intent. Differential Revision: https://phab.mercurial-scm.org/D3377
author Gregory Szorc <gregory.szorc@gmail.com>
date Sat, 14 Apr 2018 09:57:44 -0700
parents f83cb91b052e
children 43221a57e22f
comparison
equal deleted inserted replaced
37716:dfc51a482031 37717:0664be4f0c1f
411 # this changeset was introduced. Someone should fix 411 # this changeset was introduced. Someone should fix
412 # the remainig bit and drop this line 412 # the remainig bit and drop this line
413 'bisect.state', 413 'bisect.state',
414 } 414 }
415 415
416 def __init__(self, baseui, path, create=False): 416 def __init__(self, baseui, path, create=False, intents=None):
417 self.requirements = set() 417 self.requirements = set()
418 self.filtername = None 418 self.filtername = None
419 # wvfs: rooted at the repository root, used to access the working copy 419 # wvfs: rooted at the repository root, used to access the working copy
420 self.wvfs = vfsmod.vfs(path, expandpath=True, realpath=True) 420 self.wvfs = vfsmod.vfs(path, expandpath=True, realpath=True)
421 # vfs: rooted at .hg, used to access repo files outside of .hg/store 421 # vfs: rooted at .hg, used to access repo files outside of .hg/store
2330 def undoname(fn): 2330 def undoname(fn):
2331 base, name = os.path.split(fn) 2331 base, name = os.path.split(fn)
2332 assert name.startswith('journal') 2332 assert name.startswith('journal')
2333 return os.path.join(base, name.replace('journal', 'undo', 1)) 2333 return os.path.join(base, name.replace('journal', 'undo', 1))
2334 2334
2335 def instance(ui, path, create): 2335 def instance(ui, path, create, intents=None):
2336 return localrepository(ui, util.urllocalpath(path), create) 2336 return localrepository(ui, util.urllocalpath(path), create,
2337 intents=intents)
2337 2338
2338 def islocal(path): 2339 def islocal(path):
2339 return True 2340 return True
2340 2341
2341 def newreporequirements(repo): 2342 def newreporequirements(repo):