Patchwork [V4] record_curses: fix ui bug for newly added file

login
register
mail settings
Submitter Laurent Charignon
Date March 28, 2015, 1:35 a.m.
Message ID <ff3220b2965cde142af6.1427506535@dev919.prn2.facebook.com>
Download mbox | patch
Permalink /patch/8318/
State Accepted
Commit efa094701a05d58d505c3b0c3b3c73dba4e51e97
Headers show

Comments

Laurent Charignon - March 28, 2015, 1:35 a.m.
# HG changeset patch
# User Laurent Charignon <lcharignon@fb.com>
# Date 1427490673 25200
#      Fri Mar 27 14:11:13 2015 -0700
# Node ID ff3220b2965cde142af6f37473bb1fef1461546f
# Parent  d2276d7c1db113d743e15929106bfe65edb2e804
 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.
Matt Mackall - March 28, 2015, 5:36 a.m.
On Fri, 2015-03-27 at 18:35 -0700, Laurent Charignon wrote:
> # HG changeset patch
> # User Laurent Charignon <lcharignon@fb.com>
> # Date 1427490673 25200
> #      Fri Mar 27 14:11:13 2015 -0700
> # Node ID ff3220b2965cde142af6f37473bb1fef1461546f
> # Parent  d2276d7c1db113d743e15929106bfe65edb2e804
>  record_curses: fix ui bug for newly added file

Queued for default, thanks.

Patch

diff --git a/mercurial/crecord.py b/mercurial/crecord.py
--- a/mercurial/crecord.py
+++ b/mercurial/crecord.py
@@ -753,17 +753,12 @@ 
         if isinstance(item, uiheader):
             item.partial = False
             if item.applied:
-                if not item.special():
-                    # apply all its hunks
-                    for hnk in item.hunks:
-                        hnk.applied = True
-                        # apply all their hunklines
-                        for hunkline in hnk.changedlines:
-                            hunkline.applied = True
-                else:
-                    # all children are off (but the header is on)
-                    if len(item.allchildren()) > 0:
-                        item.partial = True
+                # apply all its hunks
+                for hnk in item.hunks:
+                    hnk.applied = True
+                    # apply all their hunklines
+                    for hunkline in hnk.changedlines:
+                        hunkline.applied = True
             else:
                 # un-apply all its hunks
                 for hnk in item.hunks: