Mercurial > public > mercurial-scm > hg-stable
diff mercurial/crecord.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 | 55fa7c3900ae |
line wrap: on
line diff
--- a/mercurial/crecord.py Sat Nov 21 17:40:26 2015 +0200 +++ b/mercurial/crecord.py Mon Nov 30 16:35:21 2015 -0800 @@ -454,7 +454,7 @@ uiheaders = [uiheader(h) for h in headers] # let user choose headers/hunks/lines, and mark their applied flags # accordingly - chunkselector(ui, uiheaders) + ret = chunkselector(ui, uiheaders) appliedhunklist = [] for hdr in uiheaders: if (hdr.applied and @@ -472,7 +472,7 @@ else: fixoffset += hnk.removed - hnk.added - return appliedhunklist + return (appliedhunklist, ret) def gethw(): """ @@ -501,6 +501,7 @@ raise error.Abort(chunkselector.initerr) # ncurses does not restore signal handler for SIGTSTP signal.signal(signal.SIGTSTP, f) + return chunkselector.opts def testdecorator(testfn, f): def u(*args, **kwargs): @@ -521,6 +522,7 @@ while True: if chunkselector.handlekeypressed(testcommands.pop(0), test=True): break + return chunkselector.opts class curseschunkselector(object): def __init__(self, headerlist, ui): @@ -528,6 +530,7 @@ self.headerlist = patch(headerlist) self.ui = ui + self.opts = {} self.errorstr = None # list of all chunks