contrib/synthrepo.py
changeset 23235 4cdc3e2810b9
parent 23234 944d6cfbe166
child 23778 a5dbec255f14
equal deleted inserted replaced
23234:944d6cfbe166 23235:4cdc3e2810b9
   408                     if path not in changes:
   408                     if path not in changes:
   409                         changes[path] = None
   409                         changes[path] = None
   410                         break
   410                         break
   411         if filesadded:
   411         if filesadded:
   412             dirs = list(pctx.dirs())
   412             dirs = list(pctx.dirs())
   413             dirs.append('')
   413             dirs.insert(0, '')
   414         for __ in xrange(pick(filesadded)):
   414         for __ in xrange(pick(filesadded)):
   415             path = [random.choice(dirs)]
   415             pathstr = ''
   416             if pick(dirsadded):
   416             while pathstr in dirs:
       
   417                 path = [random.choice(dirs)]
       
   418                 if pick(dirsadded):
       
   419                     path.append(random.choice(words))
   417                 path.append(random.choice(words))
   420                 path.append(random.choice(words))
   418             path.append(random.choice(words))
   421                 pathstr = '/'.join(filter(None, path))
   419             path = '/'.join(filter(None, path))
       
   420             data = '\n'.join(makeline()
   422             data = '\n'.join(makeline()
   421                              for __ in xrange(pick(linesinfilesadded))) + '\n'
   423                              for __ in xrange(pick(linesinfilesadded))) + '\n'
   422             changes[path] = context.memfilectx(repo, path, data)
   424             changes[pathstr] = context.memfilectx(repo, pathstr, data)
   423         def filectxfn(repo, memctx, path):
   425         def filectxfn(repo, memctx, path):
   424             return changes[path]
   426             return changes[path]
   425         if not changes:
   427         if not changes:
   426             continue
   428             continue
   427         if revs:
   429         if revs: