Commits

Steve Borho committed f51effe

status: annotate diff headers of partially selected files

Comments (0)

Files changed (1)

         file = entry[FM_PATH]
         if file not in self._filechunks: return
         entry[FM_PARTIAL_SELECTED] = False
+        self._update_partial(self.diff_model, file, False)
         for n in self._filechunks[file][1:]:
             self.diff_model[n][DM_NOT_REJECTED] = entry[FM_CHECKED]
             self.diff_model[n][DM_REJECTED] = not entry[FM_CHECKED]
             if row[DM_HEADER_CHUNK]:
                 for n in fchunks:
                     dmodel[n][DM_REJECTED] = fr[FM_CHECKED]
-                fr[FM_CHECKED] = not fr[FM_CHECKED]
-                fr[FM_PARTIAL_SELECTED] = False
-                self._update_check_count()
+                newvalue = not fr[FM_CHECKED]
+                partial = False
             else:
                 row[DM_REJECTED] = not row[DM_REJECTED]
                 rej = [ n for n in fchunks if dmodel[n][DM_REJECTED] ]
                 nonrej = [ n for n in fchunks if not dmodel[n][DM_REJECTED] ]
                 newvalue = nonrej and True or False
                 partial = rej and nonrej and True or False
-                # Update file's check status
+
+            # Update file's check status
+            if fr[FM_PARTIAL_SELECTED] != partial:
                 fr[FM_PARTIAL_SELECTED] = partial
-                if fr[FM_CHECKED] != newvalue:
-                    fr[FM_CHECKED] = newvalue
-                    self._update_check_count()
+                self._update_partial(dmodel, file, partial)
+            if fr[FM_CHECKED] != newvalue:
+                fr[FM_CHECKED] = newvalue
+                self._update_check_count()
         finally:
             for row in dmodel:
                 row[DM_NOT_REJECTED] = not row[DM_REJECTED]
 
+    def _update_partial(self, dmodel, file, partial):
+        hc = self._filechunks[file][0]
+        row = dmodel[hc]
+        markup = row[DM_CHUNK_TEXT]
+        tag = ' ** Partial **'
+        if partial and not markup.endswith(tag):
+            row[DM_CHUNK_TEXT] = markup + tag
+        elif markup.endswith(tag):
+            row[DM_CHUNK_TEXT] = markup[0:-len(tag)]
 
     def _show_diff_hunks(self, files):
         ''' Update the diff text '''
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.