Mercurial > hgsubversion
comparison hgsubversion/svnexternals.py @ 1503:180e0d5fba2e
join: remove uses of repo.join/wjoin
Upstream Mercurial has dropped these functions as of 4.3. Let's switch to the
appropriate repo.[w]vfs.join functions.
author | Durham Goode <durham@fb.com> |
---|---|
date | Tue, 09 May 2017 15:20:16 -0700 |
parents | 77da55e0baa4 |
children | bdffbddfa704 |
comparison
equal
deleted
inserted
replaced
1502:fb91566d849c | 1503:180e0d5fba2e |
---|---|
287 def __init__(self, ui, repo): | 287 def __init__(self, ui, repo): |
288 self.repo = repo | 288 self.repo = repo |
289 self.ui = ui | 289 self.ui = ui |
290 | 290 |
291 def update(self, wpath, rev, source, pegrev): | 291 def update(self, wpath, rev, source, pegrev): |
292 path = self.repo.wjoin(wpath) | 292 path = self.repo.wvfs.join(wpath) |
293 revspec = [] | 293 revspec = [] |
294 if rev: | 294 if rev: |
295 revspec = ['-r', rev] | 295 revspec = ['-r', rev] |
296 if os.path.isdir(path): | 296 if os.path.isdir(path): |
297 exturl, _extroot, extrev = getsvninfo(path) | 297 exturl, _extroot, extrev = getsvninfo(path) |
319 self.ui.status(_('fetching external %s@%s\n') % | 319 self.ui.status(_('fetching external %s@%s\n') % |
320 (wpath, rev or pegrev or 'HEAD')) | 320 (wpath, rev or pegrev or 'HEAD')) |
321 self.svn(['co'] + revspec + [source, dest], cwd) | 321 self.svn(['co'] + revspec + [source, dest], cwd) |
322 | 322 |
323 def delete(self, wpath): | 323 def delete(self, wpath): |
324 path = self.repo.wjoin(wpath) | 324 path = self.repo.wvfs.join(wpath) |
325 if os.path.isdir(path): | 325 if os.path.isdir(path): |
326 self.ui.status(_('removing external %s\n') % wpath) | 326 self.ui.status(_('removing external %s\n') % wpath) |
327 | 327 |
328 def onerror(function, path, excinfo): | 328 def onerror(function, path, excinfo): |
329 if function is not os.remove: | 329 if function is not os.remove: |
366 | 366 |
367 svnroot = getsvninfo(svnurl)[1] | 367 svnroot = getsvninfo(svnurl)[1] |
368 | 368 |
369 # Retrieve current externals status | 369 # Retrieve current externals status |
370 try: | 370 try: |
371 oldext = file(repo.join('svn/externals'), 'rb').read() | 371 oldext = file(repo.vfs.join('svn/externals'), 'rb').read() |
372 except IOError: | 372 except IOError: |
373 oldext = '' | 373 oldext = '' |
374 newext = '' | 374 newext = '' |
375 ctx = repo[node] | 375 ctx = repo[node] |
376 if '.hgsvnexternals' in ctx: | 376 if '.hgsvnexternals' in ctx: |
384 elif action == 'd': | 384 elif action == 'd': |
385 updater.delete(ext[0]) | 385 updater.delete(ext[0]) |
386 else: | 386 else: |
387 raise hgutil.Abort(_('unknown update actions: %r') % action) | 387 raise hgutil.Abort(_('unknown update actions: %r') % action) |
388 | 388 |
389 file(repo.join('svn/externals'), 'wb').write(newext) | 389 file(repo.vfs.join('svn/externals'), 'wb').write(newext) |
390 | 390 |
391 def getchanges(ui, repo, parentctx, exts): | 391 def getchanges(ui, repo, parentctx, exts): |
392 """Take a parent changectx and the new externals definitions as an | 392 """Take a parent changectx and the new externals definitions as an |
393 externalsfile and return a dictionary mapping the special file | 393 externalsfile and return a dictionary mapping the special file |
394 hgsubversion needs for externals bookkeeping, to their new content | 394 hgsubversion needs for externals bookkeeping, to their new content |