def task_update(self, task): description = "" matter = utils.parse_matter(sys.stdin.read()) post = matter['frontmatter'] description = matter['content'].strip() t = model.Task(None) t.phid = utils.phid_lookup(task) if not t.phid: print("Error looking up Task number...") return -1 t.description = description if ('title' in post): t.title = post['title'] if ('points' in post): t.points = post['points'] if ('assigned' in post): t.assigned = post['assigned'] if len(matter['comment']): t.comment = matter['comment'] t.commit()
def patch(self, diff_name): phid = utils.phid_lookup(diff_name) r = model.Revision.fromPHID(phid) rawdiff = diff.ParsedDiff(r.diff.diff) patch = self.genpatch(r, rawdiff.parsed(), False, False, True) return self.apply_patch(patch)
def rawdiff(self, diff_name, context, show_comments, ignore_whitespace): phid = utils.phid_lookup(diff_name) r = model.Revision.fromPHID(phid) rawdiff = diff.ParsedDiff(str(r.diff.diff)) if not context and ignore_whitespace: context = 5 if context: rawdiff = self.context(r, rawdiff, context, ignore_whitespace) if not show_comments: patch = self.genpatch(r, rawdiff.parsed(), False, False, True) print(patch, end='') return 0 annotated = rawdiff.annotate(r) print(self.genpatch(r, annotated, True, False, True), end='') return 0
def diff_comment(self, diff_name, context, show_comments): phid = utils.phid_lookup(diff_name) r = model.Revision.fromPHID(phid) annotated_diff = sys.stdin.read() matter = utils.parse_matter(annotated_diff) annotated_diff = matter['content'] d = diff.ParsedDiff(str(r.diff.diff)) if context: d = self.context(r, d, context) comments = d.comments(annotated_diff) inlines = d.inlines(comments) utils.diff_inline_comments(phid, r.id, inlines) # Do we have normal comments? if len(matter['comment']): utils.diff_add_comment(phid, matter['comment'])
def diff_resign(self, diff_name): phid = utils.phid_lookup(diff_name) utils.diff_action(phid, 'resign')
def diff_commandeer(self, diff_name): phid = utils.phid_lookup(diff_name) utils.diff_action(phid, 'commandeer')
def diff_request_changes(self, diff_name): phid = utils.phid_lookup(diff_name) utils.diff_action(phid, 'reject')
def diff_reclaim(self, diff_name): phid = utils.phid_lookup(diff_name) utils.diff_action(phid, 'reclaim')
def diff_accept(self, diff_name): phid = utils.phid_lookup(diff_name) utils.diff_action(phid, 'accept')
def diff_abandon(self, diff_name): phid = utils.phid_lookup(diff_name) utils.diff_action(phid, 'abandon')
def diff_close(self, diff_name): phid = utils.phid_lookup(diff_name) utils.diff_action(phid, 'close')
def diff_request_review(self, diff_name): phid = utils.phid_lookup(diff_name) utils.diff_action(phid, 'request-review')
def diff_plan_changes(self, diff_name): phid = utils.phid_lookup(diff_name) utils.diff_action(phid, 'plan-changes')
def fromName(name): phid = utils.phid_lookup(name) return Task.fromPHID(phid)