示例#1
0
    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()
示例#2
0
    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)
示例#3
0
    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
示例#4
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'])
示例#5
0
 def diff_resign(self, diff_name):
     phid = utils.phid_lookup(diff_name)
     utils.diff_action(phid, 'resign')
示例#6
0
 def diff_commandeer(self, diff_name):
     phid = utils.phid_lookup(diff_name)
     utils.diff_action(phid, 'commandeer')
示例#7
0
 def diff_request_changes(self, diff_name):
     phid = utils.phid_lookup(diff_name)
     utils.diff_action(phid, 'reject')
示例#8
0
 def diff_reclaim(self, diff_name):
     phid = utils.phid_lookup(diff_name)
     utils.diff_action(phid, 'reclaim')
示例#9
0
 def diff_accept(self, diff_name):
     phid = utils.phid_lookup(diff_name)
     utils.diff_action(phid, 'accept')
示例#10
0
 def diff_abandon(self, diff_name):
     phid = utils.phid_lookup(diff_name)
     utils.diff_action(phid, 'abandon')
示例#11
0
 def diff_close(self, diff_name):
     phid = utils.phid_lookup(diff_name)
     utils.diff_action(phid, 'close')
示例#12
0
 def diff_request_review(self, diff_name):
     phid = utils.phid_lookup(diff_name)
     utils.diff_action(phid, 'request-review')
示例#13
0
 def diff_plan_changes(self, diff_name):
     phid = utils.phid_lookup(diff_name)
     utils.diff_action(phid, 'plan-changes')
示例#14
0
 def fromName(name):
     phid = utils.phid_lookup(name)
     return Task.fromPHID(phid)