equal
deleted
inserted
replaced
15 from .node import nullid |
15 from .node import nullid |
16 from . import ( |
16 from . import ( |
17 error, |
17 error, |
18 match as matchmod, |
18 match as matchmod, |
19 merge as mergemod, |
19 merge as mergemod, |
|
20 pathutil, |
20 pycompat, |
21 pycompat, |
21 scmutil, |
22 scmutil, |
22 util, |
23 util, |
23 ) |
24 ) |
24 |
25 |
614 printchanges(repo.ui, opts, profilecount, includecount, excludecount, |
615 printchanges(repo.ui, opts, profilecount, includecount, excludecount, |
615 *fcounts) |
616 *fcounts) |
616 |
617 |
617 def updateconfig(repo, pats, opts, include=False, exclude=False, reset=False, |
618 def updateconfig(repo, pats, opts, include=False, exclude=False, reset=False, |
618 delete=False, enableprofile=False, disableprofile=False, |
619 delete=False, enableprofile=False, disableprofile=False, |
619 force=False): |
620 force=False, usereporootpaths=False): |
620 """Perform a sparse config update. |
621 """Perform a sparse config update. |
621 |
622 |
622 Only one of the actions may be performed. |
623 Only one of the actions may be performed. |
623 |
624 |
624 The new config is written out and a working directory refresh is performed. |
625 The new config is written out and a working directory refresh is performed. |
636 newexclude = set(oldexclude) |
637 newexclude = set(oldexclude) |
637 newprofiles = set(oldprofiles) |
638 newprofiles = set(oldprofiles) |
638 |
639 |
639 if any(os.path.isabs(pat) for pat in pats): |
640 if any(os.path.isabs(pat) for pat in pats): |
640 raise error.Abort(_('paths cannot be absolute')) |
641 raise error.Abort(_('paths cannot be absolute')) |
|
642 |
|
643 if not usereporootpaths: |
|
644 # let's treat paths as relative to cwd |
|
645 root, cwd = repo.root, repo.getcwd() |
|
646 abspats = [] |
|
647 for kindpat in pats: |
|
648 kind, pat = matchmod._patsplit(kindpat, None) |
|
649 if kind in matchmod.cwdrelativepatternkinds or kind is None: |
|
650 ap = (kind + ':' if kind else '') +\ |
|
651 pathutil.canonpath(root, cwd, pat) |
|
652 abspats.append(ap) |
|
653 else: |
|
654 abspats.append(kindpat) |
|
655 pats = abspats |
641 |
656 |
642 if include: |
657 if include: |
643 newinclude.update(pats) |
658 newinclude.update(pats) |
644 elif exclude: |
659 elif exclude: |
645 newexclude.update(pats) |
660 newexclude.update(pats) |