fi
;;
tracker)
- OPTS="--testing --add-labels --remove-labels"
+ OPTS="--testing --add-labels --remove-labels --comment"
;;
update)
OPTS="--integration --stable --all --upgrade --update-cache"
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'
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"""