comparison mercurial/cmdutil.py @ 34928:362096cfdb1f stable

terse: split on repo separator instead of os.sep (issue5715) The paths being processed are from scmutil.status, and therefore normalized to '/' separators.
author Matt Harbison <matt_harbison@yahoo.com>
date Fri, 27 Oct 2017 23:48:38 -0400
parents 0ccfc468423a
children 527655a049ee 3649c3f2cd90
comparison
equal deleted inserted replaced
34927:c2695cbb5fb1 34928:362096cfdb1f
402 with repo.wlock(): 402 with repo.wlock():
403 return recordfunc(ui, repo, message, match, opts) 403 return recordfunc(ui, repo, message, match, opts)
404 404
405 return commit(ui, repo, recordinwlock, pats, opts) 405 return commit(ui, repo, recordinwlock, pats, opts)
406 406
407
408 # extracted at module level as it's required each time a file will be added
409 # to dirnode class object below
410 pathsep = pycompat.ossep
411
412 class dirnode(object): 407 class dirnode(object):
413 """ 408 """
414 Represent a directory in user working copy with information required for 409 Represent a directory in user working copy with information required for
415 the purpose of tersing its status. 410 the purpose of tersing its status.
416 411
444 there. 439 there.
445 """ 440 """
446 441
447 # the filename contains a path separator, it means it's not the direct 442 # the filename contains a path separator, it means it's not the direct
448 # child of this directory 443 # child of this directory
449 if pathsep in filename: 444 if '/' in filename:
450 subdir, filep = filename.split(pathsep, 1) 445 subdir, filep = filename.split('/', 1)
451 446
452 # does the dirnode object for subdir exists 447 # does the dirnode object for subdir exists
453 if subdir not in self.subdirs: 448 if subdir not in self.subdirs:
454 subdirpath = os.path.join(self.path, subdir) 449 subdirpath = os.path.join(self.path, subdir)
455 self.subdirs[subdir] = dirnode(subdirpath) 450 self.subdirs[subdir] = dirnode(subdirpath)