comparison mercurial/crecord.py @ 24492:efa094701a05

record_curses: fix ui bug for newly added file With record's curses interface toggling and untoggling a newly added file would lead to a confusing UI (the header was marked as partial and the hunks as unselected). Tested additionally using the curses interface with newly added, removed and modified files in a test repo.
author Laurent Charignon <lcharignon@fb.com>
date Fri, 27 Mar 2015 14:11:13 -0700
parents 3a4122bb9488
children 23727465ff72
comparison
equal deleted inserted replaced
24491:784b278b349c 24492:efa094701a05
751 item.applied = not item.applied 751 item.applied = not item.applied
752 752
753 if isinstance(item, uiheader): 753 if isinstance(item, uiheader):
754 item.partial = False 754 item.partial = False
755 if item.applied: 755 if item.applied:
756 if not item.special(): 756 # apply all its hunks
757 # apply all its hunks 757 for hnk in item.hunks:
758 for hnk in item.hunks: 758 hnk.applied = True
759 hnk.applied = True 759 # apply all their hunklines
760 # apply all their hunklines 760 for hunkline in hnk.changedlines:
761 for hunkline in hnk.changedlines: 761 hunkline.applied = True
762 hunkline.applied = True
763 else:
764 # all children are off (but the header is on)
765 if len(item.allchildren()) > 0:
766 item.partial = True
767 else: 762 else:
768 # un-apply all its hunks 763 # un-apply all its hunks
769 for hnk in item.hunks: 764 for hnk in item.hunks:
770 hnk.applied = False 765 hnk.applied = False
771 hnk.partial = False 766 hnk.partial = False