mirror of
https://github.com/facebook/sapling.git
synced 2024-12-29 08:02:24 +03:00
sparse: make path absoluteness checks cross-platform
Summary: Let's be friendlier to our friends on Windows. Test Plan: rt Reviewers: mjpieters, #fbhgext Differential Revision: https://phab.mercurial-scm.org/D194
This commit is contained in:
parent
4e6c705cbd
commit
99b1950cd9
@ -758,10 +758,9 @@ def _config(ui, repo, pats, opts, include=False, exclude=False, reset=False,
|
|||||||
newexclude = set(oldexclude)
|
newexclude = set(oldexclude)
|
||||||
newprofiles = set(oldprofiles)
|
newprofiles = set(oldprofiles)
|
||||||
|
|
||||||
if any(pat.startswith('/') for pat in pats):
|
if any(os.path.isabs(pat) for pat in pats):
|
||||||
err = _('paths cannot start with /')
|
err = _('paths cannot be absolute')
|
||||||
hint = _('do not use absolute paths')
|
raise error.Abort(err)
|
||||||
raise error.Abort(err, hint=hint)
|
|
||||||
|
|
||||||
if (not ui.configbool('sparse', 'includereporootpaths', False)
|
if (not ui.configbool('sparse', 'includereporootpaths', False)
|
||||||
and (include or exclude)):
|
and (include or exclude)):
|
||||||
|
@ -28,14 +28,12 @@ Verify basic --include
|
|||||||
Absolute paths outside the repo should just be rejected
|
Absolute paths outside the repo should just be rejected
|
||||||
|
|
||||||
$ hg sparse --include /foo/bar
|
$ hg sparse --include /foo/bar
|
||||||
abort: paths cannot start with /
|
abort: paths cannot be absolute
|
||||||
(do not use absolute paths)
|
|
||||||
[255]
|
[255]
|
||||||
$ hg sparse --include '$TESTTMP/myrepo/hide'
|
$ hg sparse --include '$TESTTMP/myrepo/hide'
|
||||||
|
|
||||||
$ hg sparse --include '/root'
|
$ hg sparse --include '/root'
|
||||||
abort: paths cannot start with /
|
abort: paths cannot be absolute
|
||||||
(do not use absolute paths)
|
|
||||||
[255]
|
[255]
|
||||||
|
|
||||||
Repo root-relaive vs. cwd-relative includes
|
Repo root-relaive vs. cwd-relative includes
|
||||||
|
Loading…
Reference in New Issue
Block a user