diff --git a/hgext3rd/sparse.py b/hgext3rd/sparse.py --- a/hgext3rd/sparse.py +++ b/hgext3rd/sparse.py @@ -738,8 +738,9 @@ oldstatus = repo.status() if any(pat.startswith('/') for pat in pats): - ui.warn(_('warning: paths cannot start with /, ignoring: %s\n') - % ([pat for pat in pats if pat.startswith('/')])) + err = _('paths cannot start with /') + hint = _('do not use absolute paths') + raise error.Abort(err, hint=hint) elif include: newinclude.update(pats) elif exclude: diff --git a/tests/test-sparse.t b/tests/test-sparse.t --- a/tests/test-sparse.t +++ b/tests/test-sparse.t @@ -28,11 +28,15 @@ Absolute paths outside the repo should just be rejected $ hg sparse --include /foo/bar - warning: paths cannot start with /, ignoring: ['/foo/bar'] + abort: paths cannot start with / + (do not use absolute paths) + [255] $ hg sparse --include '$TESTTMP/myrepo/hide' $ hg sparse --include '/root' - warning: paths cannot start with /, ignoring: ['/root'] + abort: paths cannot start with / + (do not use absolute paths) + [255] Verify commiting while sparse includes other files