Changelog
=========
+v1.5
+----
+
+- New ``precheck`` command
+- ``phpunit`` can run a whole test suite - Andrew Nicols
+- ``tracker`` can add comments to an issue - Andrew Nicols
+- ``tracker`` can add/remove labels to an issue - Andrew Nicols
+- ``config flatlist`` has an optional ``--grep`` argument
+
v1.4
----
fi
;;
tracker)
- OPTS="--testing --add-labels --remove-labels"
+ OPTS="--testing --add-labels --remove-labels --comment"
;;
update)
OPTS="--integration --stable --all --upgrade --update-cache"
"""
import logging
+import re
from ..command import Command
from ..tools import launchEditor, yesOrNo
from ..config import ConfigObject, ConfigFileCouldNotBeLoaded
{
'help': 'flat list of the settings'
},
- []
+ [
+ (
+ ['-g', '--grep'],
+ {
+ 'metavar': 'string',
+ 'help': 'filter results using regular expressions'
+ }
+ ),
+ ]
),
'list': (
{
print u' ' * ident + '[%s]' % name
self.dictDisplay(setting, ident + 2)
- def flatDisplay(self, data, parent=''):
+ def flatDisplay(self, data, parent='', regex=None):
for name in sorted(data.keys()):
setting = data[name]
if type(setting) != dict:
+ if regex and not regex.search(parent + name):
+ continue
print u'%s: %s' % (parent + name, setting)
else:
- self.flatDisplay(setting, parent + name + u'.')
+ self.flatDisplay(setting, parent=parent + name + u'.', regex=regex)
def run(self, args):
if args.action == 'list':
current.write(new.read())
elif args.action == 'flatlist':
- self.flatDisplay(self.C.get())
+ regex = None
+ if args.grep:
+ regex = re.compile(args.grep, re.I)
+ self.flatDisplay(self.C.get(), regex=regex)
elif args.action == 'show':
setting = self.C.get(args.setting)
def on_modified(self, event):
self.process(event)
+ def on_moved(self, event):
+ self.process(event)
+
def process(self, event):
if event.is_directory:
return
import re
from ..command import Command
from ..jira import Jira
-from ..tools import parseBranch
+from ..tools import parseBranch, getText
class TrackerCommand(Command):
'metavar': 'labels',
'nargs': '+',
}
+ ),
+ (
+ ['--comment'],
+ {
+ 'action': 'store_true',
+ 'help': 'add a comment to the issue',
+ }
)
]
_description = 'Interact with Moodle tracker'
if args.removelabels:
if 'triaged' in args.removelabels:
self.argumentError('The label \'triaged\' cannot be removed using MDK')
- elif 'triaging_in_progress' in args.addlabels:
+ elif 'triaging_in_progress' in args.removelabels:
self.argumentError('The label \'triaging_in_progress\' cannot be removed using MDK')
self.Jira.removeLabels(self.mdl, args.removelabels)
+ if args.comment:
+ comment = getText()
+ self.Jira.addComment(self.mdl, comment)
+
self.info(args)
def info(self, args):
self._load()
+ def addComment(self, key, comment):
+ """Add a comment to an issue"""
+
+ assert isinstance(comment, str), "Expected a string"
+
+ data = [
+ {'add': {'body': comment}}
+ ]
+
+ self.updateIssue(key, {'update': {'comment': data}})
+
+ return True
+
def addLabels(self, key, labels):
"""Add labels to an issue"""
// Any kind of password is allowed.
mdk_set_config('passwordpolicy', 0);
+// Allow web cron.
+mdk_set_config('cronclionly', 0);
+
// Debug the performance.
mdk_set_config('perfdebug', 15);
$default = $settings->passwordpolicy->get_defaultsetting();
mdk_set_config('passwordpolicy', $default);
+// Allow web cron.
+$default = $settings->cronclionly->get_defaultsetting();
+mdk_set_config('cronclionly', $default);
+
// Theme settings.
$settingspage = $adminroot->locate('themesettings', true);
return tmpfile.name
+def getText(suffix='.md', initialText=None):
+ """Gets text from the user using an Editor
+
+ This is a shortcut to using launchEditor as it returns text rather
+ than the file in which the text entered is stored.
+
+ When the returned value is empty, the user is asked is they want to resume.
+ """
+ with tempfile.NamedTemporaryFile(suffix=suffix, delete=False) as tmpfile:
+ if initialText:
+ tmpfile.write(initialText)
+ tmpfile.flush()
+ while True:
+ editorFile = launchEditor(suffix=suffix, filepath=tmpfile.name)
+ text = None
+ with open(editorFile, 'r') as f:
+ text = f.read()
+
+ if len(text) <= 0:
+ if not yesOrNo('No content detected. Would you like to resume editing?'):
+ return ''
+ else:
+ return text
+
def md5file(filepath):
"""Return the md5 sum of a file
This is terribly memory inefficient!"""
http://github.com/FMCorz/mdk
"""
-__version__ = "1.4.1"
+__version__ = "1.5.0"
keyring>=3.5
-jenkinsapi>=0.2.25
+jenkinsapi==0.2.25
MySQL-python>=1.2.3
psycopg2>=2.4.5
requests>=2.2.1
-watchdog>=0.8.0
\ No newline at end of file
+watchdog>=0.8.0