comparison mercurial/context.py @ 40816:1c8c54cf9725 stable 4.8.1

rebase: fix path auditing to audit path relative to repo root (issue5818) Before this patch, when rebasing a file called "foo/bar", we would check e.g. if "/foo" (i.e. rooted at the file system root) was a symlink. Differential Revision: https://phab.mercurial-scm.org/D5361
author Martin von Zweigbergk <martinvonz@google.com>
date Tue, 20 Nov 2018 14:43:27 -0800
parents 44c2e80db985
children cb372d09d30a 328557af18eb
comparison
equal deleted inserted replaced
40815:d10b1dc13431 40816:1c8c54cf9725
1846 component = "/".join(components[0:i]) 1846 component = "/".join(components[0:i])
1847 if component in self: 1847 if component in self:
1848 fail(path, component) 1848 fail(path, component)
1849 1849
1850 # Test the other direction -- that this path from p2 isn't a directory 1850 # Test the other direction -- that this path from p2 isn't a directory
1851 # in p1 (test that p1 doesn't any paths matching `path/*`). 1851 # in p1 (test that p1 doesn't have any paths matching `path/*`).
1852 match = matchmod.match('/', '', [path + '/'], default=b'relpath') 1852 match = self.match(pats=[path + '/'], default=b'path')
1853 matches = self.p1().manifest().matches(match) 1853 matches = self.p1().manifest().matches(match)
1854 mfiles = matches.keys() 1854 mfiles = matches.keys()
1855 if len(mfiles) > 0: 1855 if len(mfiles) > 0:
1856 if len(mfiles) == 1 and mfiles[0] == path: 1856 if len(mfiles) == 1 and mfiles[0] == path:
1857 return 1857 return