comparison mercurial/patch.py @ 27155:8d3c5797a175

commit: add a way to return more information from the chunkselector Before this patch, the chunkselector for record or crecord was used to return the list of hunks that were selected by the user. The goal of this series is to reintroduce the toggle amend feature for crecord. To do so, we need to be able to return more than just the selected hunks from the chunkselector but also the information: is amend mode toggled. This patch adds a new return value for chunkselectors that will be used to implement the toggle amend feature in crecord.
author Laurent Charignon <lcharignon@fb.com>
date Mon, 30 Nov 2015 16:35:21 -0800
parents 1aee2ab0f902
children 186f2afe9919
comparison
equal deleted inserted replaced
27154:3bc7919fb215 27155:8d3c5797a175
1104 if fixoffset: 1104 if fixoffset:
1105 newhunk.toline += fixoffset 1105 newhunk.toline += fixoffset
1106 applied[newhunk.filename()].append(newhunk) 1106 applied[newhunk.filename()].append(newhunk)
1107 else: 1107 else:
1108 fixoffset += chunk.removed - chunk.added 1108 fixoffset += chunk.removed - chunk.added
1109 return sum([h for h in applied.itervalues() 1109 return (sum([h for h in applied.itervalues()
1110 if h[0].special() or len(h) > 1], []) 1110 if h[0].special() or len(h) > 1], []), {})
1111 class hunk(object): 1111 class hunk(object):
1112 def __init__(self, desc, num, lr, context): 1112 def __init__(self, desc, num, lr, context):
1113 self.number = num 1113 self.number = num
1114 self.desc = desc 1114 self.desc = desc
1115 self.hunk = [desc] 1115 self.hunk = [desc]