Add change list options to configuration
This change adds default sorting options for the change list to the configuration file. Change-Id: I5a20b1be359535e91b015a40bdedc1fc30e8ac0d
This commit is contained in:
parent
abfe8013bc
commit
497fd3f358
@ -138,6 +138,13 @@ commentlinks:
|
||||
# selected. The default is "status:open".
|
||||
# change-list-query: "status:open"
|
||||
|
||||
# This section defines default sorting options for the change list. The
|
||||
# "sort-by" key specifies the sort order, which can be 'number' or 'updated'.
|
||||
# The 'reverse' key specifies ascending (true) or descending (false) order.
|
||||
# change-list-options:
|
||||
# sort-by: 'number'
|
||||
# reverse: false
|
||||
|
||||
# Uncomment the following line to use a unified diff view instead
|
||||
# of the default side-by-side:
|
||||
# diff-view: unified
|
||||
@ -189,4 +196,4 @@ reviewkeys:
|
||||
approvals:
|
||||
- category: 'Code-Review'
|
||||
value: 2
|
||||
submit: True
|
||||
submit: True
|
||||
|
@ -93,6 +93,9 @@ class ConfigSchema(object):
|
||||
|
||||
hide_comments = [hide_comment]
|
||||
|
||||
change_list_options = {'sort-by': v.Any('number', 'updated'),
|
||||
'reverse': bool}
|
||||
|
||||
keymap = {v.Required('name'): str,
|
||||
v.Match('(?!name)'): v.Any([str], str)}
|
||||
|
||||
@ -111,7 +114,8 @@ class ConfigSchema(object):
|
||||
'diff-view': str,
|
||||
'hide-comments': self.hide_comments,
|
||||
'thread-changes': bool,
|
||||
'display-times-in-utc': bool
|
||||
'display-times-in-utc': bool,
|
||||
'change-list-options': self.change_list_options,
|
||||
})
|
||||
return schema
|
||||
|
||||
@ -215,6 +219,11 @@ class Config(object):
|
||||
self.thread_changes = self.config.get('thread-changes', True)
|
||||
self.utc = self.config.get('display-times-in-utc', False)
|
||||
|
||||
change_list_options = self.config.get('change-list-options', {})
|
||||
self.change_list_options = {
|
||||
'sort-by': change_list_options.get('sort-by', 'number'),
|
||||
'reverse': change_list_options.get('reverse', False)}
|
||||
|
||||
def getServer(self, name=None):
|
||||
for server in self.config['servers']:
|
||||
if name is None or name == server['name']:
|
||||
|
@ -173,8 +173,8 @@ class ChangeListView(urwid.WidgetWrap):
|
||||
self.project_key = project_key
|
||||
if project_key is not None:
|
||||
self.display_project = False
|
||||
self.sort_by = 'number'
|
||||
self.reverse = False
|
||||
self.sort_by = app.config.change_list_options['sort-by']
|
||||
self.reverse = app.config.change_list_options['reverse']
|
||||
self.header = ChangeListHeader(self.display_project, self.display_owner,
|
||||
self.display_updated)
|
||||
self.categories = []
|
||||
|
Loading…
x
Reference in New Issue
Block a user