##// END OF EJS Templates
synthrepo: create filectx instance in 'filectxfn' callback...
Martin von Zweigbergk -
r35399:2123e762 default
parent child Browse files
Show More
@@ -369,14 +369,14 b' def synthesize(ui, repo, descpath, **opt'
369 369 while not validpath(path):
370 370 path = pickpath()
371 371 data = '%s contents\n' % path
372 files[path] = context.memfilectx(repo, path, data)
372 files[path] = data
373 373 dir = os.path.dirname(path)
374 374 while dir and dir not in dirs:
375 375 dirs.add(dir)
376 376 dir = os.path.dirname(dir)
377 377
378 378 def filectxfn(repo, memctx, path):
379 return files[path]
379 return context.memfilectx(repo, path, files[path])
380 380
381 381 ui.progress(_synthesizing, None)
382 382 message = 'synthesized wide repo with %d files' % (len(files),)
@@ -444,14 +444,12 b' def synthesize(ui, repo, descpath, **opt'
444 444 for __ in xrange(add):
445 445 lines.insert(random.randint(0, len(lines)), makeline())
446 446 path = fctx.path()
447 changes[path] = context.memfilectx(repo, path,
448 '\n'.join(lines) + '\n')
447 changes[path] = '\n'.join(lines) + '\n'
449 448 for __ in xrange(pick(filesremoved)):
450 449 path = random.choice(mfk)
451 450 for __ in xrange(10):
452 451 path = random.choice(mfk)
453 452 if path not in changes:
454 changes[path] = None
455 453 break
456 454 if filesadded:
457 455 dirs = list(pctx.dirs())
@@ -466,9 +464,11 b' def synthesize(ui, repo, descpath, **opt'
466 464 pathstr = '/'.join(filter(None, path))
467 465 data = '\n'.join(makeline()
468 466 for __ in xrange(pick(linesinfilesadded))) + '\n'
469 changes[pathstr] = context.memfilectx(repo, pathstr, data)
467 changes[pathstr] = data
470 468 def filectxfn(repo, memctx, path):
471 return changes[path]
469 if path not in changes:
470 return None
471 return context.memfilectx(repo, path, changes[path])
472 472 if not changes:
473 473 continue
474 474 if revs:
General Comments 0
You need to be logged in to leave comments. Login now