##// END OF EJS Templates
synthrepo: new filenames must not also be new directories, and vice-versa...
Mike Edgar -
r23778:a5dbec25 default
parent child Browse files
Show More
@@ -323,15 +323,32 b' def synthesize(ui, repo, descpath, **opt'
323 323 initcount = int(opts['initfiles'])
324 324 if initcount and initdirs:
325 325 pctx = repo[None].parents()[0]
326 dirs = set(pctx.dirs())
326 327 files = {}
328
329 def validpath(path):
330 # Don't pick filenames which are already directory names.
331 if path in dirs:
332 return False
333 # Don't pick directories which were used as file names.
334 while path:
335 if path in files:
336 return False
337 path = os.path.dirname(path)
338 return True
339
327 340 for i in xrange(0, initcount):
328 341 ui.progress(_synthesizing, i, unit=_files, total=initcount)
329 342
330 343 path = pickpath()
331 while path in pctx.dirs():
344 while not validpath(path):
332 345 path = pickpath()
333 346 data = '%s contents\n' % path
334 347 files[path] = context.memfilectx(repo, path, data)
348 dir = os.path.dirname(path)
349 while dir and dir not in dirs:
350 dirs.add(dir)
351 dir = os.path.dirname(dir)
335 352
336 353 def filectxfn(repo, memctx, path):
337 354 return files[path]
General Comments 0
You need to be logged in to leave comments. Login now