Esempio n. 1
0
    def do_request_merge_edit(self, **kw):
        require_access(self.req, 'write')
        try:
            kw = self.mr_widget_edit.to_python(kw)
        except formencode.Invalid:
            # trigger error_handler directly
            return self.edit(**kw)
        changes = OrderedDict()
        if self.req.summary != kw['summary']:
            changes['Summary'] = [self.req.summary, kw['summary']]
            self.req.summary = kw['summary']

        if self.req.target_branch != kw['target_branch']:
            changes['Target branch'] = [self.req.target_branch, kw['target_branch']]
            self.req.target_branch = kw['target_branch']

        if self.req.source_branch != kw['source_branch']:
            changes['Source branch'] = [self.req.source_branch, kw['source_branch']]
            self.req.source_branch = kw['source_branch']

        if self.req.description != kw['description']:
            changes['Description'] = h.unidiff(self.req.description, kw['description'])
            self.req.description = kw['description']

        if changes:
            self.req.add_meta_post(changes=changes)
            g.director.create_activity(c.user, 'updated', self.req,
                                       related_nodes=[c.project], tags=['merge-request'])
        self.refresh()
Esempio n. 2
0
    def do_request_merge_edit(self, **kw):
        require_access(self.req, 'write')
        kw = self.mr_widget_edit.to_python(kw)
        changes = OrderedDict()
        if self.req.summary != kw['summary']:
            changes['Summary'] = [self.req.summary, kw['summary']]
            self.req.summary = kw['summary']

        if self.req.target_branch != kw['target_branch']:
            changes['Target branch'] = [
                self.req.target_branch, kw['target_branch']
            ]
            self.req.target_branch = kw['target_branch']

        if self.req.source_branch != kw['source_branch']:
            changes['Source branch'] = [
                self.req.source_branch, kw['source_branch']
            ]
            self.req.source_branch = kw['source_branch']

        if self.req.description != kw['description']:
            changes['Description'] = h.unidiff(self.req.description,
                                               kw['description'])
            self.req.description = kw['description']

        if changes:
            self.req.add_meta_post(changes=changes)
            g.director.create_activity(c.user,
                                       'updated',
                                       self.req,
                                       related_nodes=[c.project],
                                       tags=['merge-request'])
        self.refresh()
Esempio n. 3
0
    def do_request_merge_edit(self, **kw):
        require_access(self.req, 'write')
        kw = self.mr_widget_edit.to_python(kw)
        changes = OrderedDict()
        if self.req.summary != kw['summary']:
            changes['Summary'] = [self.req.summary, kw['summary']]
            self.req.summary = kw['summary']

        if self.req.target_branch != kw['target_branch']:
            changes['Target branch'] = [self.req.target_branch, kw['target_branch']]
            self.req.target_branch = kw['target_branch']

        if self.req.source_branch != kw['source_branch']:
            changes['Source branch'] = [self.req.source_branch, kw['source_branch']]
            self.req.source_branch = kw['source_branch']

        if self.req.description != kw['description']:
            changes['Description'] = h.unidiff(self.req.description, kw['description'])
            self.req.description = kw['description']
        with self.req.push_downstream_context():
            self.req.downstream['commit_id'] = c.app.repo.commit(kw['source_branch'])._id

        message = self.tmpl.render(changes=changes)
        self.req.discussion_thread.add_post(text=message, is_meta=True)
        redirect(self.req.url())
Esempio n. 4
0
    def do_request_merge_edit(self, **kw):
        require_access(self.req, 'write')
        try:
            kw = self.mr_widget_edit.to_python(kw)
        except formencode.Invalid:
            # trigger error_handler directly
            return self.edit(**kw)
        changes = OrderedDict()
        old_text = self.req.description
        if self.req.summary != kw['summary']:
            changes['Summary'] = [self.req.summary, kw['summary']]
            self.req.summary = kw['summary']

        if self.req.target_branch != kw['target_branch']:
            changes['Target branch'] = [
                self.req.target_branch, kw['target_branch']
            ]
            self.req.target_branch = kw['target_branch']

        if self.req.source_branch != kw['source_branch']:
            changes['Source branch'] = [
                self.req.source_branch, kw['source_branch']
            ]
            self.req.source_branch = kw['source_branch']

        if self.req.description != kw['description']:
            changes['Description'] = h.unidiff(self.req.description,
                                               kw['description'])
            self.req.description = kw['description']

        if changes:
            self.req.add_meta_post(changes=changes)
            allura.tasks.notification_tasks.send_usermentions_notification.post(
                self.req.index_id(), kw['description'], old_text)
            g.director.create_activity(c.user,
                                       'updated',
                                       self.req,
                                       related_nodes=[c.project],
                                       tags=['merge-request'])
        self.refresh()