Mercurial > public > mercurial-scm > hg
comparison mercurial/sparse.py @ 33683:7dcb517122f9
sparse: properly error out when absolute paths are used
Current logic is misleading (it says it drops only absolute paths, but
it actually drops all of them), not cross-platform (does not support Windows)
and IMO just wrong (as it should just error out if absolute paths are given).
This commit fixes it.
author | Kostia Balytskyi <ikostia@fb.com> |
---|---|
date | Wed, 02 Aug 2017 15:05:21 -0700 |
parents | 22371eabb3b1 |
children | e1c56486d1aa |
comparison
equal
deleted
inserted
replaced
33682:1d5e497c08b3 | 33683:7dcb517122f9 |
---|---|
634 else: | 634 else: |
635 newinclude = set(oldinclude) | 635 newinclude = set(oldinclude) |
636 newexclude = set(oldexclude) | 636 newexclude = set(oldexclude) |
637 newprofiles = set(oldprofiles) | 637 newprofiles = set(oldprofiles) |
638 | 638 |
639 if any(pat.startswith('/') for pat in pats): | 639 if any(os.path.isabs(pat) for pat in pats): |
640 repo.ui.warn(_('warning: paths cannot start with /, ignoring: %s\n') | 640 raise error.Abort(_('paths cannot be absolute')) |
641 % ([pat for pat in pats if pat.startswith('/')])) | 641 |
642 elif include: | 642 if include: |
643 newinclude.update(pats) | 643 newinclude.update(pats) |
644 elif exclude: | 644 elif exclude: |
645 newexclude.update(pats) | 645 newexclude.update(pats) |
646 elif enableprofile: | 646 elif enableprofile: |
647 newprofiles.update(pats) | 647 newprofiles.update(pats) |