Show More
@@ -78,9 +78,9 b' class ShortRepository(object):' | |||
|
78 | 78 | def __repr__(self): |
|
79 | 79 | return '<ShortRepository: %s>' % self.scheme |
|
80 | 80 | |
|
81 | def instance(self, ui, url, create): | |
|
81 | def instance(self, ui, url, create, intents=None): | |
|
82 | 82 | url = self.resolve(url) |
|
83 | return hg._peerlookup(url).instance(ui, url, create) | |
|
83 | return hg._peerlookup(url).instance(ui, url, create, intents=intents) | |
|
84 | 84 | |
|
85 | 85 | def resolve(self, url): |
|
86 | 86 | # Should this use the util.url class, or is manual parsing better? |
@@ -450,7 +450,7 b' class bundlerepository(localrepo.localre' | |||
|
450 | 450 | self.ui.warn(msg % nodemod.hex(p2)) |
|
451 | 451 | return super(bundlerepository, self).setparents(p1, p2) |
|
452 | 452 | |
|
453 | def instance(ui, path, create): | |
|
453 | def instance(ui, path, create, intents=None): | |
|
454 | 454 | if create: |
|
455 | 455 | raise error.Abort(_('cannot create new bundle repository')) |
|
456 | 456 | # internal config: bundle.mainreporoot |
@@ -928,7 +928,8 b' def _dispatch(req):' | |||
|
928 | 928 | else: |
|
929 | 929 | try: |
|
930 | 930 | repo = hg.repository(ui, path=path, |
|
931 |
presetupfuncs=req.prereposetups |
|
|
931 | presetupfuncs=req.prereposetups, | |
|
932 | intents=func.intents) | |
|
932 | 933 | if not repo.local(): |
|
933 | 934 | raise error.Abort(_("repository '%s' is not local") |
|
934 | 935 | % path) |
@@ -157,9 +157,10 b' def openpath(ui, path):' | |||
|
157 | 157 | # a list of (ui, repo) functions called for wire peer initialization |
|
158 | 158 | wirepeersetupfuncs = [] |
|
159 | 159 | |
|
160 |
def _peerorrepo(ui, path, create=False, presetupfuncs=None |
|
|
160 | def _peerorrepo(ui, path, create=False, presetupfuncs=None, | |
|
161 | intents=None): | |
|
161 | 162 | """return a repository object for the specified path""" |
|
162 | obj = _peerlookup(path).instance(ui, path, create) | |
|
163 | obj = _peerlookup(path).instance(ui, path, create, intents=intents) | |
|
163 | 164 | ui = getattr(obj, "ui", ui) |
|
164 | 165 | for f in presetupfuncs or []: |
|
165 | 166 | f(ui, obj) |
@@ -172,19 +173,20 b' def _peerorrepo(ui, path, create=False, ' | |||
|
172 | 173 | f(ui, obj) |
|
173 | 174 | return obj |
|
174 | 175 | |
|
175 | def repository(ui, path='', create=False, presetupfuncs=None): | |
|
176 | def repository(ui, path='', create=False, presetupfuncs=None, intents=None): | |
|
176 | 177 | """return a repository object for the specified path""" |
|
177 |
peer = _peerorrepo(ui, path, create, presetupfuncs=presetupfuncs |
|
|
178 | peer = _peerorrepo(ui, path, create, presetupfuncs=presetupfuncs, | |
|
179 | intents=intents) | |
|
178 | 180 | repo = peer.local() |
|
179 | 181 | if not repo: |
|
180 | 182 | raise error.Abort(_("repository '%s' is not local") % |
|
181 | 183 | (path or peer.url())) |
|
182 | 184 | return repo.filtered('visible') |
|
183 | 185 | |
|
184 | def peer(uiorrepo, opts, path, create=False): | |
|
186 | def peer(uiorrepo, opts, path, create=False, intents=None): | |
|
185 | 187 | '''return a repository peer for the specified path''' |
|
186 | 188 | rui = remoteui(uiorrepo, opts) |
|
187 | return _peerorrepo(rui, path, create).peer() | |
|
189 | return _peerorrepo(rui, path, create, intents=intents).peer() | |
|
188 | 190 | |
|
189 | 191 | def defaultdest(source): |
|
190 | 192 | '''return default destination of clone if none is given |
@@ -990,7 +990,7 b' def makepeer(ui, path, opener=None, requ' | |||
|
990 | 990 | return httppeer(ui, path, respurl, opener, requestbuilder, |
|
991 | 991 | info['v1capabilities']) |
|
992 | 992 | |
|
993 | def instance(ui, path, create): | |
|
993 | def instance(ui, path, create, intents=None): | |
|
994 | 994 | if create: |
|
995 | 995 | raise error.Abort(_('cannot create new http repository')) |
|
996 | 996 | try: |
@@ -413,7 +413,7 b' class localrepository(object):' | |||
|
413 | 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 | 417 | self.requirements = set() |
|
418 | 418 | self.filtername = None |
|
419 | 419 | # wvfs: rooted at the repository root, used to access the working copy |
@@ -2332,8 +2332,9 b' def undoname(fn):' | |||
|
2332 | 2332 | assert name.startswith('journal') |
|
2333 | 2333 | return os.path.join(base, name.replace('journal', 'undo', 1)) |
|
2334 | 2334 | |
|
2335 | def instance(ui, path, create): | |
|
2336 |
return localrepository(ui, util.urllocalpath(path), create |
|
|
2335 | def instance(ui, path, create, intents=None): | |
|
2336 | return localrepository(ui, util.urllocalpath(path), create, | |
|
2337 | intents=intents) | |
|
2337 | 2338 | |
|
2338 | 2339 | def islocal(path): |
|
2339 | 2340 | return True |
@@ -587,7 +587,7 b' def makepeer(ui, path, proc, stdin, stdo' | |||
|
587 | 587 | raise error.RepoError(_('unknown version of SSH protocol: %s') % |
|
588 | 588 | protoname) |
|
589 | 589 | |
|
590 | def instance(ui, path, create): | |
|
590 | def instance(ui, path, create, intents=None): | |
|
591 | 591 | """Create an SSH peer. |
|
592 | 592 | |
|
593 | 593 | The returned object conforms to the ``wireprotov1peer.wirepeer`` interface. |
@@ -215,7 +215,7 b' class statichttprepository(localrepo.loc' | |||
|
215 | 215 | def _writecaches(self): |
|
216 | 216 | pass # statichttprepository are read only |
|
217 | 217 | |
|
218 | def instance(ui, path, create): | |
|
218 | def instance(ui, path, create, intents=None): | |
|
219 | 219 | if create: |
|
220 | 220 | raise error.Abort(_('cannot create new static-http repository')) |
|
221 | 221 | return statichttprepository(ui, path[7:]) |
@@ -231,7 +231,7 b' class unionrepository(localrepo.localrep' | |||
|
231 | 231 | def getcwd(self): |
|
232 | 232 | return pycompat.getcwd() # always outside the repo |
|
233 | 233 | |
|
234 | def instance(ui, path, create): | |
|
234 | def instance(ui, path, create, intents=None): | |
|
235 | 235 | if create: |
|
236 | 236 | raise error.Abort(_('cannot create new union repository')) |
|
237 | 237 | parentpath = ui.config("bundle", "mainreporoot") |
General Comments 0
You need to be logged in to leave comments.
Login now