contrib/synthrepo.py
changeset 21689 503bb3af70fe
parent 20672 05e58b08fdfe
child 22446 054ec0212718
equal deleted inserted replaced
21688:cc677803bad4 21689:503bb3af70fe
   332                         break
   332                         break
   333                     del lines[random.randrange(0, len(lines))]
   333                     del lines[random.randrange(0, len(lines))]
   334                 for __ in xrange(add):
   334                 for __ in xrange(add):
   335                     lines.insert(random.randint(0, len(lines)), makeline())
   335                     lines.insert(random.randint(0, len(lines)), makeline())
   336                 path = fctx.path()
   336                 path = fctx.path()
   337                 changes[path] = context.memfilectx(path,
   337                 changes[path] = context.memfilectx(repo, path,
   338                                                    '\n'.join(lines) + '\n')
   338                                                    '\n'.join(lines) + '\n')
   339             for __ in xrange(pick(filesremoved)):
   339             for __ in xrange(pick(filesremoved)):
   340                 path = random.choice(mfk)
   340                 path = random.choice(mfk)
   341                 for __ in xrange(10):
   341                 for __ in xrange(10):
   342                     path = random.choice(mfk)
   342                     path = random.choice(mfk)
   352                 path.append(random.choice(words))
   352                 path.append(random.choice(words))
   353             path.append(random.choice(words))
   353             path.append(random.choice(words))
   354             path = '/'.join(filter(None, path))
   354             path = '/'.join(filter(None, path))
   355             data = '\n'.join(makeline()
   355             data = '\n'.join(makeline()
   356                              for __ in xrange(pick(linesinfilesadded))) + '\n'
   356                              for __ in xrange(pick(linesinfilesadded))) + '\n'
   357             changes[path] = context.memfilectx(path, data)
   357             changes[path] = context.memfilectx(repo, path, data)
   358         def filectxfn(repo, memctx, path):
   358         def filectxfn(repo, memctx, path):
   359             data = changes[path]
   359             data = changes[path]
   360             if data is None:
   360             if data is None:
   361                 raise IOError
   361                 raise IOError
   362             return data
   362             return data