Details
Details
- Reviewers
- None
- Group Reviewers
hg-reviewers - Commits
- rHG3f467db023a2: crecord: completely redraw screen when coming back from editor
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Lint
Lint Skipped - Unit
Unit Tests Skipped
hg-reviewers |
Lint Skipped |
Unit Tests Skipped |
Path | Packages | |||
---|---|---|---|---|
M | mercurial/crecord.py (11 lines) |
Commit | Parents | Author | Summary | Date |
---|---|---|---|---|
Kyle Lippincott | Mar 13 2019, 9:39 PM |
return u | return u | ||||
def testchunkselector(testfn, ui, headerlist, operation=None): | def testchunkselector(testfn, ui, headerlist, operation=None): | ||||
""" | """ | ||||
test interface to get selection of chunks, and mark the applied flags | test interface to get selection of chunks, and mark the applied flags | ||||
of the chosen chunks. | of the chosen chunks. | ||||
""" | """ | ||||
chunkselector = curseschunkselector(headerlist, ui, operation) | chunkselector = curseschunkselector(headerlist, ui, operation) | ||||
class dummystdscr(object): | |||||
def clear(self): | |||||
pass | |||||
def refresh(self): | |||||
pass | |||||
chunkselector.stdscr = dummystdscr() | |||||
if testfn and os.path.exists(testfn): | if testfn and os.path.exists(testfn): | ||||
testf = open(testfn, 'rb') | testf = open(testfn, 'rb') | ||||
testcommands = [x.rstrip('\n') for x in testf.readlines()] | testcommands = [x.rstrip('\n') for x in testf.readlines()] | ||||
testf.close() | testf.close() | ||||
while True: | while True: | ||||
if chunkselector.handlekeypressed(testcommands.pop(0), test=True): | if chunkselector.handlekeypressed(testcommands.pop(0), test=True): | ||||
break | break | ||||
return chunkselector.opts | return chunkselector.opts | ||||
chunk.write(patch) | chunk.write(patch) | ||||
# start the editor and wait for it to complete | # start the editor and wait for it to complete | ||||
try: | try: | ||||
patch = self.ui.edit(patch.getvalue(), "", action="diff") | patch = self.ui.edit(patch.getvalue(), "", action="diff") | ||||
except error.Abort as exc: | except error.Abort as exc: | ||||
self.errorstr = str(exc) | self.errorstr = str(exc) | ||||
return None | return None | ||||
finally: | |||||
self.stdscr.clear() | |||||
self.stdscr.refresh() | |||||
# remove comment lines | # remove comment lines | ||||
patch = [line + '\n' for line in patch.splitlines() | patch = [line + '\n' for line in patch.splitlines() | ||||
if not line.startswith('#')] | if not line.startswith('#')] | ||||
return patchmod.parsepatch(patch) | return patchmod.parsepatch(patch) | ||||
if item is None: | if item is None: | ||||
item = self.currentselecteditem | item = self.currentselecteditem |