Ejemplo n.º 1
0
    def patch(self, review_request_id, squash=False):
        """Patch a single review request's diff using rbt patch.

        Args:
            review_request_id (int):
                The ID of the review request to patch.

            squash (bool, optional):
                Whether to squash multiple commits into a single commit.

        Raises:
            rbtools.commands.CommandError:
                There was an error applying the patch.
        """
        patch_command = [RB_MAIN, 'patch']
        patch_command.extend(build_rbtools_cmd_argv(self.options))

        if self.options.edit:
            patch_command.append('-c')
        else:
            patch_command.append('-C')

        if squash:
            patch_command.append('--squash')

        patch_command.append(six.text_type(review_request_id))

        rc, output = execute(patch_command,
                             ignore_errors=True,
                             return_error_code=True)

        if rc:
            raise CommandError('Failed to execute "rbt patch":\n%s' % output)
Ejemplo n.º 2
0
Archivo: land.py Proyecto: drbr/rbtools
    def patch(self, review_request_id):
        patch_command = [RB_MAIN, 'patch']
        patch_command.extend(build_rbtools_cmd_argv(self.options))

        if self.options.edit:
            patch_command.append('-c')
        else:
            patch_command.append('-C')

        patch_command.append(review_request_id)

        p = subprocess.Popen(patch_command)
        rc = p.wait()

        if rc:
            die('Failed to execute command: %s' % patch_command)
Ejemplo n.º 3
0
    def patch(self, review_request_id):
        patch_command = [RB_MAIN, 'patch']
        patch_command.extend(build_rbtools_cmd_argv(self.options))

        if self.options.edit:
            patch_command.append('-c')
        else:
            patch_command.append('-C')

        patch_command.append(review_request_id)

        p = subprocess.Popen(patch_command)
        rc = p.wait()

        if rc:
            die('Failed to execute command: %s' % patch_command)
Ejemplo n.º 4
0
    def patch(self, review_request_id):
        """Patch a single review request's diff using rbt patch."""
        patch_command = [RB_MAIN, 'patch']
        patch_command.extend(build_rbtools_cmd_argv(self.options))

        if self.options.edit:
            patch_command.append('-c')
        else:
            patch_command.append('-C')

        patch_command.append(six.text_type(review_request_id))

        rc, output = execute(patch_command, return_error_code=True)

        if rc:
            raise CommandError('Failed to execute "rbt patch":\n%s'
                               % output)
Ejemplo n.º 5
0
    def patch(self, review_request_id):
        """Patch a single review request's diff using rbt patch."""
        patch_command = [RB_MAIN, 'patch']
        patch_command.extend(build_rbtools_cmd_argv(self.options))

        if self.options.edit:
            patch_command.append('-c')
        else:
            patch_command.append('-C')

        patch_command.append(six.text_type(review_request_id))

        rc, output = execute(patch_command, ignore_errors=True,
                             return_error_code=True)

        if rc:
            raise CommandError('Failed to execute "rbt patch":\n%s'
                               % output)
Ejemplo n.º 6
0
 def patch(self, review_request_id):
     patch_command = [RB_MAIN, 'patch']
     patch_command.extend(build_rbtools_cmd_argv(self.options))
     patch_command.append('-C')
     patch_command.append(review_request_id)
     print(execute(patch_command))