mirror of
https://github.com/facebook/sapling.git
synced 2024-12-27 23:22:02 +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)
|
||||
newprofiles = set(oldprofiles)
|
||||
|
||||
if any(pat.startswith('/') for pat in pats):
|
||||
err = _('paths cannot start with /')
|
||||
hint = _('do not use absolute paths')
|
||||
raise error.Abort(err, hint=hint)
|
||||
if any(os.path.isabs(pat) for pat in pats):
|
||||
err = _('paths cannot be absolute')
|
||||
raise error.Abort(err)
|
||||
|
||||
if (not ui.configbool('sparse', 'includereporootpaths', False)
|
||||
and (include or exclude)):
|
||||
|
@ -28,14 +28,12 @@ Verify basic --include
|
||||
Absolute paths outside the repo should just be rejected
|
||||
|
||||
$ hg sparse --include /foo/bar
|
||||
abort: paths cannot start with /
|
||||
(do not use absolute paths)
|
||||
abort: paths cannot be absolute
|
||||
[255]
|
||||
$ hg sparse --include '$TESTTMP/myrepo/hide'
|
||||
|
||||
$ hg sparse --include '/root'
|
||||
abort: paths cannot start with /
|
||||
(do not use absolute paths)
|
||||
abort: paths cannot be absolute
|
||||
[255]
|
||||
|
||||
Repo root-relaive vs. cwd-relative includes
|
||||
|
Loading…
Reference in New Issue
Block a user