示例#1
0
 def __init__(self):
     options = []
     self._prepare_sequence = StepSequence(self.prepare_steps)
     self._main_sequence = StepSequence(self.main_steps)
     options = sorted(
         set(self._prepare_sequence.options() +
             self._main_sequence.options()))
     AbstractPatchProcessingCommand.__init__(self, options)
示例#2
0
class AbstractSequencedCommmand(AbstractDeclarativeCommmand):
    steps = None
    def __init__(self):
        self._sequence = StepSequence(self.steps)
        AbstractDeclarativeCommmand.__init__(self, self._sequence.options())

    def _prepare_state(self, options, args, tool):
        return None

    def execute(self, options, args, tool):
        self._sequence.run_and_handle_errors(tool, options, self._prepare_state(options, args, tool))
示例#3
0
class AbstractSequencedCommmand(AbstractDeclarativeCommmand):
    steps = None

    def __init__(self):
        self._sequence = StepSequence(self.steps)
        AbstractDeclarativeCommmand.__init__(self, self._sequence.options())

    def _prepare_state(self, options, args, tool):
        return None

    def execute(self, options, args, tool):
        self._sequence.run_and_handle_errors(
            tool, options, self._prepare_state(options, args, tool))
示例#4
0
 def __init__(self):
     self._sequence = StepSequence([
         CleanWorkingDirectoryStep,
         UpdateStep,
         RevertRevisionStep,
         PrepareChangeLogForRevertStep,
         CompleteRollout,
     ])
     Command.__init__(
         self,
         "Revert the given revision in the working copy and optionally commit the revert and re-open the original bug",
         "REVISION [BUGID]",
         options=self._sequence.options())
示例#5
0
class Rollout(Command):
    name = "rollout"
    show_in_main_help = True

    def __init__(self):
        self._sequence = StepSequence([
            CleanWorkingDirectoryStep,
            UpdateStep,
            RevertRevisionStep,
            PrepareChangeLogForRevertStep,
            CompleteRollout,
        ])
        Command.__init__(
            self,
            "Revert the given revision in the working copy and optionally commit the revert and re-open the original bug",
            "REVISION [BUGID]",
            options=self._sequence.options())

    @staticmethod
    def _parse_bug_id_from_revision_diff(tool, revision):
        original_diff = tool.scm().diff_for_revision(revision)
        return parse_bug_id(original_diff)

    @staticmethod
    def _reopen_bug_after_rollout(tool, bug_id, comment_text):
        if bug_id:
            tool.bugs.reopen_bug(bug_id, comment_text)
        else:
            log(comment_text)
            log("No bugs were updated or re-opened to reflect this rollout.")

    def execute(self, options, args, tool):
        revision = args[0]
        bug_id = self._parse_bug_id_from_revision_diff(tool, revision)
        if options.complete_rollout:
            if bug_id:
                log("Will re-open bug %s after rollout." % bug_id)
            else:
                log("Failed to parse bug number from diff.  No bugs will be updated/reopened after the rollout."
                    )

        state = {
            "revision": revision,
            "bug_id": bug_id,
        }
        self._sequence.run_and_handle_errors(tool, options, state)
示例#6
0
 def __init__(self):
     self._sequence = StepSequence([
         CleanWorkingDirectoryStep,
         UpdateStep,
         RevertRevisionStep,
         PrepareChangeLogForRevertStep,
         CompleteRollout,
     ])
     Command.__init__(self, "Revert the given revision in the working copy and optionally commit the revert and re-open the original bug", "REVISION [BUGID]", options=self._sequence.options())
示例#7
0
class Rollout(Command):
    name = "rollout"
    show_in_main_help = True
    def __init__(self):
        self._sequence = StepSequence([
            CleanWorkingDirectoryStep,
            UpdateStep,
            RevertRevisionStep,
            PrepareChangeLogForRevertStep,
            CompleteRollout,
        ])
        Command.__init__(self, "Revert the given revision in the working copy and optionally commit the revert and re-open the original bug", "REVISION [BUGID]", options=self._sequence.options())

    @staticmethod
    def _parse_bug_id_from_revision_diff(tool, revision):
        original_diff = tool.scm().diff_for_revision(revision)
        return parse_bug_id(original_diff)

    @staticmethod
    def _reopen_bug_after_rollout(tool, bug_id, comment_text):
        if bug_id:
            tool.bugs.reopen_bug(bug_id, comment_text)
        else:
            log(comment_text)
            log("No bugs were updated or re-opened to reflect this rollout.")

    def execute(self, options, args, tool):
        revision = args[0]
        bug_id = self._parse_bug_id_from_revision_diff(tool, revision)
        if options.complete_rollout:
            if bug_id:
                log("Will re-open bug %s after rollout." % bug_id)
            else:
                log("Failed to parse bug number from diff.  No bugs will be updated/reopened after the rollout.")

        state = {
            "revision": revision,
            "bug_id": bug_id,
        }
        self._sequence.run_and_handle_errors(tool, options, state)
示例#8
0
class AbstractPatchSequencingCommand(AbstractPatchProcessingCommand):
    prepare_steps = None
    main_steps = None

    def __init__(self):
        options = []
        self._prepare_sequence = StepSequence(self.prepare_steps)
        self._main_sequence = StepSequence(self.main_steps)
        options = sorted(set(self._prepare_sequence.options() + self._main_sequence.options()))
        AbstractPatchProcessingCommand.__init__(self, options)

    def _prepare_to_process(self, options, args, tool):
        self._prepare_sequence.run_and_handle_errors(tool, options)

    def _process_patch(self, patch, options, args, tool):
        state = { "patch" : patch }
        self._main_sequence.run_and_handle_errors(tool, options, state)
示例#9
0
class AbstractPatchSequencingCommand(AbstractPatchProcessingCommand):
    prepare_steps = None
    main_steps = None

    def __init__(self):
        options = []
        self._prepare_sequence = StepSequence(self.prepare_steps)
        self._main_sequence = StepSequence(self.main_steps)
        options = sorted(
            set(self._prepare_sequence.options() +
                self._main_sequence.options()))
        AbstractPatchProcessingCommand.__init__(self, options)

    def _prepare_to_process(self, options, args, tool):
        self._prepare_sequence.run_and_handle_errors(tool, options)

    def _process_patch(self, patch, options, args, tool):
        state = {"patch": patch}
        self._main_sequence.run_and_handle_errors(tool, options, state)
示例#10
0
 def __init__(self):
     self._sequence = StepSequence(self.steps)
     AbstractDeclarativeCommmand.__init__(self, self._sequence.options())
示例#11
0
 def __init__(self):
     self._sequence = StepSequence(self.steps)
     AbstractDeclarativeCommmand.__init__(self, self._sequence.options())
示例#12
0
 def __init__(self):
     options = []
     self._prepare_sequence = StepSequence(self.prepare_steps)
     self._main_sequence = StepSequence(self.main_steps)
     options = sorted(set(self._prepare_sequence.options() + self._main_sequence.options()))
     AbstractPatchProcessingCommand.__init__(self, options)