comparison hgsubversion/util.py @ 1182:8f9619a67565

maps: change readmapfile to take a path instead of repo This is a small refactor for an upcoming change that will change map objects to store a svnmeta instead of the repo.
author Sean Farley <sean.michael.farley@gmail.com>
date Mon, 24 Mar 2014 11:20:44 -0500
parents 91d685418490
children 05aea77371a3
comparison
equal deleted inserted replaced
1181:eb4c7bc23f9e 1182:8f9619a67565
341 ''' 341 '''
342 args = revset.getargs(x, 0, 0, "fromsvn takes no arguments") 342 args = revset.getargs(x, 0, 0, "fromsvn takes no arguments")
343 343
344 rev = repo.changelog.rev 344 rev = repo.changelog.rev
345 bin = node.bin 345 bin = node.bin
346 meta = repo.svnmeta(skiperrorcheck=True)
346 try: 347 try:
347 svnrevs = set(rev(bin(l.split(' ', 2)[1])) 348 svnrevs = set(rev(bin(l.split(' ', 2)[1]))
348 for l in maps.RevMap.readmapfile(repo, missingok=False)) 349 for l in maps.RevMap.readmapfile(meta.revmap_file,
350 missingok=False))
349 return filter(svnrevs.__contains__, subset) 351 return filter(svnrevs.__contains__, subset)
350 except IOError, err: 352 except IOError, err:
351 if err.errno != errno.ENOENT: 353 if err.errno != errno.ENOENT:
352 raise 354 raise
353 raise hgutil.Abort("svn metadata is missing - " 355 raise hgutil.Abort("svn metadata is missing - "
366 except ValueError: 368 except ValueError:
367 raise error.ParseError("the argument to svnrev() must be a number") 369 raise error.ParseError("the argument to svnrev() must be a number")
368 370
369 rev = rev + ' ' 371 rev = rev + ' '
370 revs = [] 372 revs = []
371 try: 373 meta = repo.svnmeta(skiperrorcheck=True)
372 for l in maps.RevMap.readmapfile(repo, missingok=False): 374 try:
375 for l in maps.RevMap.readmapfile(meta.revmap_file, missingok=False):
373 if l.startswith(rev): 376 if l.startswith(rev):
374 n = l.split(' ', 2)[1] 377 n = l.split(' ', 2)[1]
375 r = repo[node.bin(n)].rev() 378 r = repo[node.bin(n)].rev()
376 if r in subset: 379 if r in subset:
377 revs.append(r) 380 revs.append(r)