##// END OF EJS Templates
sparse: shorten try..except block in updateconfig()...
Gregory Szorc -
r33376:d5a38eae default
parent child Browse files
Show More
@@ -599,7 +599,6 def updateconfig(repo, pats, opts, inclu
599 599 oldinclude, oldexclude, oldprofiles = parseconfig(repo.ui, raw)
600 600 oldprofiles = set(oldprofiles)
601 601
602 try:
603 602 if reset:
604 603 newinclude = set()
605 604 newexclude = set()
@@ -612,9 +611,8 def updateconfig(repo, pats, opts, inclu
612 611 oldstatus = repo.status()
613 612
614 613 if any(pat.startswith('/') for pat in pats):
615 repo.ui.warn(_('warning: paths cannot start with /, '
616 'ignoring: %s\n') %
617 ([pat for pat in pats if pat.startswith('/')]))
614 repo.ui.warn(_('warning: paths cannot start with /, ignoring: %s\n')
615 % ([pat for pat in pats if pat.startswith('/')]))
618 616 elif include:
619 617 newinclude.update(pats)
620 618 elif exclude:
@@ -627,18 +625,22 def updateconfig(repo, pats, opts, inclu
627 625 newinclude.difference_update(pats)
628 626 newexclude.difference_update(pats)
629 627
630 writeconfig(repo, newinclude, newexclude, newprofiles)
631
632 fcounts = map(
633 len,
634 refreshwdir(repo, oldstatus, oldmatcher, force=force))
635
636 628 profilecount = (len(newprofiles - oldprofiles) -
637 629 len(oldprofiles - newprofiles))
638 630 includecount = (len(newinclude - oldinclude) -
639 631 len(oldinclude - newinclude))
640 632 excludecount = (len(newexclude - oldexclude) -
641 633 len(oldexclude - newexclude))
634
635 # TODO clean up this writeconfig() + try..except pattern once we can.
636 # See comment in importfromfiles() explaining it.
637 writeconfig(repo, newinclude, newexclude, newprofiles)
638
639 try:
640 fcounts = map(
641 len,
642 refreshwdir(repo, oldstatus, oldmatcher, force=force))
643
642 644 printchanges(repo.ui, opts, profilecount, includecount,
643 645 excludecount, *fcounts)
644 646 except Exception:
General Comments 0
You need to be logged in to leave comments. Login now