Enable review keys in diffs, and close change on review
- Add a config option to enable closing a change after a review is saved, and going back to the change list. - Enable reviewKeys from the change page to also work on the diff view. Change-Id: I37d907132a012d074d38345f15ef83ec7d9f3e6c
This commit is contained in:
parent
d92570abd4
commit
7892a19cb9
@ -320,6 +320,9 @@ For example, to hide comments from a CI system:
|
||||
Specifies how patch diffs should be displayed. The values `unified`
|
||||
or `side-by-side` (the default) are supported.
|
||||
|
||||
**close-change-on-review**
|
||||
When a review is saved, close the change view and pop up to the
|
||||
previous screen, which will be the change list for the repo.
|
||||
|
||||
Dashboards
|
||||
++++++++++
|
||||
|
@ -166,6 +166,10 @@ commentlinks:
|
||||
# at the bottom of the screen:
|
||||
# breadcrumbs: false
|
||||
|
||||
# Uncomment the following line to close a change after saving
|
||||
# a review.
|
||||
# close-change-on-review: true
|
||||
|
||||
# Uncomment the following line to use a unified diff view instead
|
||||
# of the default side-by-side:
|
||||
# diff-view: unified
|
||||
|
@ -401,6 +401,11 @@ class App(object):
|
||||
self.clearInputBuffer()
|
||||
self.frame.body = widget
|
||||
|
||||
def getPreviousScreen(self):
|
||||
if not self.screens:
|
||||
return None
|
||||
return self.screens[-1]
|
||||
|
||||
def backScreen(self, target_widget=None):
|
||||
if not self.screens:
|
||||
return
|
||||
|
@ -133,6 +133,7 @@ class ConfigSchema(object):
|
||||
'display-times-in-utc': bool,
|
||||
'handle-mouse': bool,
|
||||
'breadcrumbs': bool,
|
||||
'close-change-on-review': bool,
|
||||
'change-list-options': self.change_list_options,
|
||||
'expire-age': str,
|
||||
'size-column': self.size_column,
|
||||
@ -248,6 +249,7 @@ class Config(object):
|
||||
self.thread_changes = self.config.get('thread-changes', True)
|
||||
self.utc = self.config.get('display-times-in-utc', False)
|
||||
self.breadcrumbs = self.config.get('breadcrumbs', True)
|
||||
self.close_change_on_review = self.config.get('close-change-on-review', False)
|
||||
self.handle_mouse = self.config.get('handle-mouse', True)
|
||||
|
||||
change_list_options = self.config.get('change-list-options', {})
|
||||
|
@ -1170,3 +1170,5 @@ class ChangeView(urwid.WidgetWrap):
|
||||
self.app.sync.submitTask(
|
||||
sync.UploadReviewTask(message_key, sync.HIGH_PRIORITY))
|
||||
self.refresh()
|
||||
if self.app.config.close_change_on_review:
|
||||
self.app.backScreen()
|
||||
|
@ -170,7 +170,11 @@ class BaseDiffView(urwid.WidgetWrap, mywid.Searchable):
|
||||
def help(self):
|
||||
key = self.app.config.keymap.formatKeys
|
||||
commands = self.getCommands()
|
||||
return [(c[0], key(c[0]), c[1]) for c in commands]
|
||||
ret = [(c[0], key(c[0]), c[1]) for c in commands]
|
||||
for k in self.app.config.reviewkeys.values():
|
||||
action = ', '.join(['{category}:{value}'.format(**a) for a in k['approvals']])
|
||||
ret.append(('', keymap.formatKey(k['key']), action))
|
||||
return ret
|
||||
|
||||
def __init__(self, app, new_revision_key):
|
||||
super(BaseDiffView, self).__init__(urwid.Pile([]))
|
||||
@ -471,6 +475,9 @@ class BaseDiffView(urwid.WidgetWrap, mywid.Searchable):
|
||||
if keymap.INTERACTIVE_SEARCH in commands:
|
||||
self.searchStart()
|
||||
return None
|
||||
if key in self.app.config.reviewkeys:
|
||||
self.reviewKey(self.app.config.reviewkeys[key])
|
||||
return None
|
||||
return key
|
||||
|
||||
def mouse_event(self, size, event, button, x, y, focus):
|
||||
@ -521,6 +528,12 @@ class BaseDiffView(urwid.WidgetWrap, mywid.Searchable):
|
||||
key = comment.key
|
||||
return key
|
||||
|
||||
def reviewKey(self, reviewkey):
|
||||
change_view = self.app.getPreviousScreen()
|
||||
if change_view:
|
||||
change_view.reviewKey(reviewkey)
|
||||
self.app.backScreen()
|
||||
|
||||
def openPatchsetDialog(self):
|
||||
revisions = []
|
||||
with self.app.db.getSession() as session:
|
||||
|
Loading…
x
Reference in New Issue
Block a user