Exemplo n.º 1
0
    def construct(klass, old_merge_proposal, new_merge_proposal):
        """Return a new instance representing the differences.

        :param old_merge_proposal: A snapshot representing the merge
            proposal's previous state.
        :param new_merge_proposal: The merge proposal (not a snapshot).
        """
        delta = ObjectDelta(old_merge_proposal, new_merge_proposal)
        delta.recordNewValues(klass.new_values)
        delta.recordNewAndOld(klass.delta_values)
        if not delta.changes:
            return None
        return BranchMergeProposalDelta(**delta.changes)
Exemplo n.º 2
0
    def construct(klass, old_repository, new_repository, user):
        """Return a GitRepositoryDelta instance that encapsulates the changes.

        This method is primarily used by event subscription code to
        determine what has changed during an ObjectModifiedEvent.
        """
        delta = ObjectDelta(old_repository, new_repository)
        delta.recordNewAndOld(klass.delta_values)
        activities = list(
            new_repository.getActivity(
                changed_after=old_repository.date_last_modified))
        if delta.changes or activities:
            changes = delta.changes
            changes["repository"] = new_repository
            changes["user"] = user
            changes["activities"] = activities

            return GitRepositoryDelta(**changes)
        else:
            return None
Exemplo n.º 3
0
    def getDelta(self, old_spec, user):
        """See ISpecification."""
        delta = ObjectDelta(old_spec, self)
        delta.recordNewValues(("title", "summary", "specurl", "productseries",
                               "distroseries", "milestone"))
        delta.recordNewAndOld(
            ("name", "priority", "definition_status", "target", "approver",
             "assignee", "drafter", "whiteboard", "workitems_text"))
        delta.recordListAddedAndRemoved("bugs", "bugs_linked", "bugs_unlinked")

        if delta.changes:
            changes = delta.changes
            changes["specification"] = self
            changes["user"] = user

            return SpecificationDelta(**changes)
        else:
            return None
Exemplo n.º 4
0
    def construct(klass, old_merge_proposal, new_merge_proposal):
        """Return a new instance representing the differences.

        :param old_merge_proposal: A snapshot representing the merge
            proposal's previous state.
        :param new_merge_proposal: The merge proposal (not a snapshot).
        """
        delta = ObjectDelta(old_merge_proposal, new_merge_proposal)
        delta.recordNewValues(klass.new_values)
        delta.recordNewAndOld(klass.delta_values)
        if not delta.changes:
            return None
        return BranchMergeProposalDelta(**delta.changes)
Exemplo n.º 5
0
    def getDelta(self, old_spec, user):
        """See ISpecification."""
        delta = ObjectDelta(old_spec, self)
        delta.recordNewValues(("title", "summary",
                               "specurl", "productseries",
                               "distroseries", "milestone"))
        delta.recordNewAndOld(("name", "priority", "definition_status",
                               "target", "approver", "assignee", "drafter",
                               "whiteboard", "workitems_text"))
        delta.recordListAddedAndRemoved("bugs", "bugs_linked", "bugs_unlinked")

        if delta.changes:
            changes = delta.changes
            changes["specification"] = self
            changes["user"] = user

            return SpecificationDelta(**changes)
        else:
            return None
Exemplo n.º 6
0
    def construct(klass, old_branch, new_branch, user):
        """Return a BranchDelta instance that encapsulates the changes.

        This method is primarily used by event subscription code to
        determine what has changed during an ObjectModifiedEvent.
        """
        delta = ObjectDelta(old_branch, new_branch)
        delta.recordNewValues(klass.new_values)
        delta.recordNewAndOld(klass.delta_values)
        # delta.record_list_added_and_removed()
        # XXX thumper 2006-12-21: Add in bugs and specs.
        if delta.changes:
            changes = delta.changes
            changes["branch"] = new_branch
            changes["user"] = user

            return BranchDelta(**changes)
        else:
            return None
Exemplo n.º 7
0
    def construct(old_branch, new_branch, user):
        """Return a BranchDelta instance that encapsulates the changes.

        This method is primarily used by event subscription code to
        determine what has changed during an ObjectModifiedEvent.
        """
        delta = ObjectDelta(old_branch, new_branch)
        delta.recordNewValues(("summary", "whiteboard"))
        delta.recordNewAndOld(("name", "lifecycle_status",
                               "title", "url"))
        # delta.record_list_added_and_removed()
        # XXX thumper 2006-12-21: Add in bugs and specs.
        if delta.changes:
            changes = delta.changes
            changes["branch"] = new_branch
            changes["user"] = user

            return BranchDelta(**changes)
        else:
            return None