##// END OF EJS Templates
scmutil: change canonpath to use util.samefile (issue2167)...
Adrian Buehlmann -
r17007:21e18c60 default
parent child Browse files
Show More
@@ -324,18 +324,16 b' def canonpath(root, cwd, myname, auditor'
324 else:
324 else:
325 # Determine whether `name' is in the hierarchy at or beneath `root',
325 # Determine whether `name' is in the hierarchy at or beneath `root',
326 # by iterating name=dirname(name) until that causes no change (can't
326 # by iterating name=dirname(name) until that causes no change (can't
327 # check name == '/', because that doesn't work on windows). For each
327 # check name == '/', because that doesn't work on windows). The list
328 # `name', compare dev/inode numbers. If they match, the list `rel'
328 # `rel' holds the reversed list of components making up the relative
329 # holds the reversed list of components making up the relative file
329 # file name we want.
330 # name we want.
331 root_st = os.stat(root)
332 rel = []
330 rel = []
333 while True:
331 while True:
334 try:
332 try:
335 name_st = os.stat(name)
333 s = util.samefile(name, root)
336 except OSError:
334 except OSError:
337 name_st = None
335 s = False
338 if name_st and util.samestat(name_st, root_st):
336 if s:
339 if not rel:
337 if not rel:
340 # name was actually the same as root (maybe a symlink)
338 # name was actually the same as root (maybe a symlink)
341 return ''
339 return ''
General Comments 0
You need to be logged in to leave comments. Login now