third_party/blink/tools/blinkpy/w3c/local_wpt.py
def create_branch_with_patch(self,
                                 branch_name,
                                 message,
                                 patch,
                                 author,
                                 force_push=False):
        """Commits the given patch and pushes to the upstream repo.

        Args:
            branch_name: The local and remote git branch name.
            message: Commit message string.
            patch: A patch that can be applied by git apply.
            author: The git commit author.
            force_push: Applies the -f flag in `git push`.
        """
        self.clean()

        try:
            # This won't be exercised in production because wpt-exporter
            # always runs on a clean machine. But it's useful when running
            # locally since branches stick around.
            _log.info('Deleting old branch %s', branch_name)
            self.run(['git', 'branch', '-D', branch_name])
        except ScriptError:
            # This might mean the branch wasn't found. Ignore this error.
            pass

        _log.info('Creating local branch %s', branch_name)
        self.run(['git', 'checkout', '-b', branch_name])

        # Remove Chromium WPT directory prefix.
        patch = patch.replace(CHROMIUM_WPT_DIR, '')

        _log.info('Author: %s', author)
        if '<' in author:
            author_str = author
        else:
            author_str = '%s <%s>' % (author, author)

        # TODO(jeffcarp): Use git am -p<n> where n is len(CHROMIUM_WPT_DIR.split(/'))
        # or something not off-by-one.
        self.run(['git', 'apply', '-'], input=patch)
        self.run(['git', 'add', '.'])
        self.run(['git', 'commit', '--author', author_str, '-am', message])

        # Force push is necessary when updating a PR with a new patch
        # from Gerrit.
        if force_push:
            self.run(['git', 'push', '-f', 'origin', branch_name])
        else:
            self.run(['git', 'push', 'origin', branch_name])
Commits the given patch and pushes to the upstream repo.

        Args:
            branch_name: The local and remote git branch name.
            message: Commit message string.
            patch: A patch that can be applied by git apply.
            author: The git commit author.
            force_push: Applies the -f flag in `git push`.
        
Commits the given patch and pushes to the upstream repo.
Commits the given patch and pushes to the upstream repo .
def create_branch_with_patch(self,
                                 branch_name,
                                 message,
                                 patch,
                                 author,
                                 force_push=False):
        self.clean()
        try:
            _log.info('Deleting old branch %s', branch_name)
            self.run(['git', 'branch', '-D', branch_name])
        except ScriptError:
            pass
        _log.info('Creating local branch %s', branch_name)
        self.run(['git', 'checkout', '-b', branch_name])
        patch = patch.replace(CHROMIUM_WPT_DIR, '')
        _log.info('Author: %s', author)
        if '<' in author:
            author_str = author
        else:
            author_str = '%s <%s>' % (author, author)
        self.run(['git', 'apply', '-'], input=patch)
        self.run(['git', 'add', '.'])
        self.run(['git', 'commit', '--author', author_str, '-am', message])
        if force_push:
            self.run(['git', 'push', '-f', 'origin', branch_name])
        else:
            self.run(['git', 'push', 'origin', branch_name])
def create_branch_with_patch ( self , branch_name , message , patch , author , force_push = False ) : self . clean ( ) try : _log . info ( 'Deleting old branch %s' , branch_name ) self . run ( [ 'git' , 'branch' , '-D' , branch_name ] ) except ScriptError : pass _log . info ( 'Creating local branch %s' , branch_name ) self . run ( [ 'git' , 'checkout' , '-b' , branch_name ] ) patch = patch . replace ( CHROMIUM_WPT_DIR , '' ) _log . info ( 'Author: %s' , author ) if '<' in author : author_str = author else : author_str = '%s <%s>' % ( author , author ) self . run ( [ 'git' , 'apply' , '-' ] , input = patch ) self . run ( [ 'git' , 'add' , '.' ] ) self . run ( [ 'git' , 'commit' , '--author' , author_str , '-am' , message ] ) if force_push : self . run ( [ 'git' , 'push' , '-f' , 'origin' , branch_name ] ) else : self . run ( [ 'git' , 'push' , 'origin' , branch_name ] )
Commits the given patch and pushes to the upstream repo.
Commits the given patch and pushes to the upstream repo .
"""Commits the given patch and pushes to the upstream repo.

        Args:
            branch_name: The local and remote git branch name.
            message: Commit message string.
            patch: A patch that can be applied by git apply.
            author: The git commit author.
            force_push: Applies the -f flag in `git push`.
        """ # This won't be exercised in production because wpt-exporter # always runs on a clean machine. But it's useful when running # locally since branches stick around. # This might mean the branch wasn't found. Ignore this error. # Remove Chromium WPT directory prefix. # TODO(jeffcarp): Use git am -p<n> where n is len(CHROMIUM_WPT_DIR.split(/')) # or something not off-by-one. # Force push is necessary when updating a PR with a new patch # from Gerrit.
self
branch_name
The local and remote git branch name.
The local and remote git branch name .
message
Commit message string.
Commit message string .
patch
A patch that can be applied by git apply.
A patch that can be applied by git apply .
author
The git commit author.
The git commit author .
force_push
Applies the -f flag in `git push`.
Applies the - f flag in ` git push ` .