mercurial/crecord.py
changeset 24318 8d55286fe5e2
parent 24317 f559cae7892f
child 24342 be3ab98f11e0
equal deleted inserted replaced
24317:f559cae7892f 24318:8d55286fe5e2
   417     def __getattr__(self, name):
   417     def __getattr__(self, name):
   418         return getattr(self._hunk, name)
   418         return getattr(self._hunk, name)
   419     def __repr__(self):
   419     def __repr__(self):
   420         return '<hunk %r@%d>' % (self.filename(), self.fromline)
   420         return '<hunk %r@%d>' % (self.filename(), self.fromline)
   421 
   421 
   422 def filterpatch(ui, chunks, chunk_selector):
   422 def filterpatch(ui, chunks, chunkselector):
   423     """interactively filter patch chunks into applied-only chunks"""
   423     """interactively filter patch chunks into applied-only chunks"""
   424 
   424 
   425     chunks = list(chunks)
   425     chunks = list(chunks)
   426     # convert chunks list into structure suitable for displaying/modifying
   426     # convert chunks list into structure suitable for displaying/modifying
   427     # with curses.  create a list of headers only.
   427     # with curses.  create a list of headers only.
   431     if len(headers) == 0:
   431     if len(headers) == 0:
   432         return []
   432         return []
   433     uiheaders = [uiheader(h) for h in headers]
   433     uiheaders = [uiheader(h) for h in headers]
   434     # let user choose headers/hunks/lines, and mark their applied flags
   434     # let user choose headers/hunks/lines, and mark their applied flags
   435     # accordingly
   435     # accordingly
   436     chunk_selector(uiheaders, ui)
   436     chunkselector(uiheaders, ui)
   437     appliedhunklist = []
   437     appliedhunklist = []
   438     for hdr in uiheaders:
   438     for hdr in uiheaders:
   439         if (hdr.applied and
   439         if (hdr.applied and
   440             (hdr.special() or len([h for h in hdr.hunks if h.applied]) > 0)):
   440             (hdr.special() or len([h for h in hdr.hunks if h.applied]) > 0)):
   441             appliedhunklist.append(hdr)
   441             appliedhunklist.append(hdr)