Submitter | adgar@google.com |
---|---|
Date | Nov. 7, 2014, 3:07 p.m. |
Message ID | <a81819ad894bbb060617.1415372851@adgar.nyc.corp.google.com> |
Download | mbox | patch |
Permalink | /patch/6633/ |
State | Accepted |
Headers | show |
Comments
On 11/07/2014 03:07 PM, Mike Edgar wrote: > # HG changeset patch > # User Mike Edgar <adgar@google.com> > # Date 1413829243 14400 > # Mon Oct 20 14:20:43 2014 -0400 > # Node ID a81819ad894bbb060617c7a1b7fcf6ba930d3563 > # Parent 2ba7af12f8c59172e230295a238183400b19faf6 > synthrepo: when adding files, ensure new path is not a directory Those two looks good to me. I pushed them to the clowncopter.
Patch
diff -r 2ba7af12f8c5 -r a81819ad894b contrib/synthrepo.py --- a/contrib/synthrepo.py Mon Oct 20 13:59:13 2014 -0400 +++ b/contrib/synthrepo.py Mon Oct 20 14:20:43 2014 -0400 @@ -410,16 +410,18 @@ break if filesadded: dirs = list(pctx.dirs()) - dirs.append('') + dirs.insert(0, '') for __ in xrange(pick(filesadded)): - path = [random.choice(dirs)] - if pick(dirsadded): + pathstr = '' + while pathstr in dirs: + path = [random.choice(dirs)] + if pick(dirsadded): + path.append(random.choice(words)) path.append(random.choice(words)) - path.append(random.choice(words)) - path = '/'.join(filter(None, path)) + pathstr = '/'.join(filter(None, path)) data = '\n'.join(makeline() for __ in xrange(pick(linesinfilesadded))) + '\n' - changes[path] = context.memfilectx(repo, path, data) + changes[pathstr] = context.memfilectx(repo, pathstr, data) def filectxfn(repo, memctx, path): return changes[path] if not changes: