third_party/blink/tools/blinkpy/w3c/test_exporter.py
def create_or_update_pr_from_commit(self,
                                        commit,
                                        provisional,
                                        pr_number=None,
                                        pr_footer='',
                                        pr_branch_name=None):
        """Creates or updates a PR from a Chromium commit.

        The commit can be either landed or in-flight. The exportable portion of
        the patch is extracted and applied to a new branch in the local WPT
        repo, whose name is determined by pr_branch_name (if the branch already
        exists, it will be recreated from main). The branch is then pushed to
        WPT on GitHub, from which a PR is created or updated.

        Args:
            commit: A ChromiumCommit object.
            provisional: True if the commit is from a Gerrit in-flight CL,
                False if the commit has landed.
            pr_number: Optional, a PR issue number.
                If specified, updates the PR instead of creating one.
            pr_footer: Optional, additional text to be appended to PR
                description after the commit message.
            pr_branch_name: Optional, the name of the head branch of the PR.
                If unspecified, the current head branch of the PR will be used.

        Returns:
            The issue number (an int) of the updated/created PR, or None if no
            change is made.
        """
        patch = commit.format_patch()
        message = commit.message()
        subject = commit.subject()
        # Replace '<' with '\<', crbug.com/822278.
        body = commit.body().replace(r'<', r'\<')
        author = commit.author()
        updating = bool(pr_number)
        pr_description = body + pr_footer
        if not pr_branch_name:
            assert pr_number, 'pr_number and pr_branch_name cannot be both absent.'
            pr_branch_name = self.wpt_github.get_pr_branch(pr_number)

        if self.dry_run:
            action_str = 'updating' if updating else 'creating'
            origin_str = 'CL' if provisional else 'Chromium commit'
            _log.info('[dry_run] Stopping before %s PR from %s', action_str,
                      origin_str)
            _log.info('\n\n[dry_run] message:')
            _log.info(message)
            _log.debug(
                '\n[dry_run] First 500 characters of patch: << END_OF_PATCH_EXCERPT'
            )
            _log.debug(patch[0:500])
            _log.debug('END_OF_PATCH_EXCERPT')
            return

        self.local_wpt.create_branch_with_patch(
            pr_branch_name, message, patch, author, force_push=True)

        if updating:
            self.wpt_github.update_pr(pr_number, subject, pr_description)
        else:
            pr_number = self.wpt_github.create_pr(pr_branch_name, subject,
                                                  pr_description)
            self.wpt_github.add_label(pr_number, EXPORT_PR_LABEL)
            if provisional:
                self.wpt_github.add_label(pr_number, PROVISIONAL_PR_LABEL)

        return pr_number
Creates or updates a PR from a Chromium commit.

        The commit can be either landed or in-flight. The exportable portion of
        the patch is extracted and applied to a new branch in the local WPT
        repo, whose name is determined by pr_branch_name (if the branch already
        exists, it will be recreated from main). The branch is then pushed to
        WPT on GitHub, from which a PR is created or updated.

        Args:
            commit: A ChromiumCommit object.
            provisional: True if the commit is from a Gerrit in-flight CL,
                False if the commit has landed.
            pr_number: Optional, a PR issue number.
                If specified, updates the PR instead of creating one.
            pr_footer: Optional, additional text to be appended to PR
                description after the commit message.
            pr_branch_name: Optional, the name of the head branch of the PR.
                If unspecified, the current head branch of the PR will be used.

        Returns:
            The issue number (an int) of the updated/created PR, or None if no
            change is made.
        
Creates or updates a PR from a Chromium commit.
The commit can be either landed or in-flight. The exportable portion of
the patch is extracted and applied to a new branch in the local WPT
repo, whose name is determined by pr_branch_name (if the branch already
exists, it will be recreated from main). The branch is then pushed to
WPT on GitHub, from which a PR is created or updated.
Creates or updates a PR from a Chromium commit . The commit can be either landed or in - flight . The exportable portion of the patch is extracted and applied to a new branch in the local WPT repo whose name is determined by pr_branch_name ( if the branch already exists it will be recreated from main ) . The branch is then pushed to WPT on GitHub from which a PR is created or updated .
def create_or_update_pr_from_commit(self,
                                        commit,
                                        provisional,
                                        pr_number=None,
                                        pr_footer='',
                                        pr_branch_name=None):
        patch = commit.format_patch()
        message = commit.message()
        subject = commit.subject()
        body = commit.body().replace(r'<', r'\<')
        author = commit.author()
        updating = bool(pr_number)
        pr_description = body + pr_footer
        if not pr_branch_name:
            assert pr_number, 'pr_number and pr_branch_name cannot be both absent.'
            pr_branch_name = self.wpt_github.get_pr_branch(pr_number)
        if self.dry_run:
            action_str = 'updating' if updating else 'creating'
            origin_str = 'CL' if provisional else 'Chromium commit'
            _log.info('[dry_run] Stopping before %s PR from %s', action_str,
                      origin_str)
            _log.info('\n\n[dry_run] message:')
            _log.info(message)
            _log.debug(
                '\n[dry_run] First 500 characters of patch: << END_OF_PATCH_EXCERPT'
            )
            _log.debug(patch[0:500])
            _log.debug('END_OF_PATCH_EXCERPT')
            return
        self.local_wpt.create_branch_with_patch(
            pr_branch_name, message, patch, author, force_push=True)
        if updating:
            self.wpt_github.update_pr(pr_number, subject, pr_description)
        else:
            pr_number = self.wpt_github.create_pr(pr_branch_name, subject,
                                                  pr_description)
            self.wpt_github.add_label(pr_number, EXPORT_PR_LABEL)
            if provisional:
                self.wpt_github.add_label(pr_number, PROVISIONAL_PR_LABEL)
        return pr_number
def create_or_update_pr_from_commit ( self , commit , provisional , pr_number = None , pr_footer = '' , pr_branch_name = None ) : patch = commit . format_patch ( ) message = commit . message ( ) subject = commit . subject ( ) body = commit . body ( ) . replace ( r'<' , r'\<' ) author = commit . author ( ) updating = bool ( pr_number ) pr_description = body + pr_footer if not pr_branch_name : assert pr_number , 'pr_number and pr_branch_name cannot be both absent.' pr_branch_name = self . wpt_github . get_pr_branch ( pr_number ) if self . dry_run : action_str = 'updating' if updating else 'creating' origin_str = 'CL' if provisional else 'Chromium commit' _log . info ( '[dry_run] Stopping before %s PR from %s' , action_str , origin_str ) _log . info ( '\n\n[dry_run] message:' ) _log . info ( message ) _log . debug ( '\n[dry_run] First 500 characters of patch: << END_OF_PATCH_EXCERPT' ) _log . debug ( patch [ 0 : 500 ] ) _log . debug ( 'END_OF_PATCH_EXCERPT' ) return self . local_wpt . create_branch_with_patch ( pr_branch_name , message , patch , author , force_push = True ) if updating : self . wpt_github . update_pr ( pr_number , subject , pr_description ) else : pr_number = self . wpt_github . create_pr ( pr_branch_name , subject , pr_description ) self . wpt_github . add_label ( pr_number , EXPORT_PR_LABEL ) if provisional : self . wpt_github . add_label ( pr_number , PROVISIONAL_PR_LABEL ) return pr_number
Creates or updates a PR from a Chromium commit.
Creates or updates a PR from a Chromium commit .
"""Creates or updates a PR from a Chromium commit.

        The commit can be either landed or in-flight. The exportable portion of
        the patch is extracted and applied to a new branch in the local WPT
        repo, whose name is determined by pr_branch_name (if the branch already
        exists, it will be recreated from main). The branch is then pushed to
        WPT on GitHub, from which a PR is created or updated.

        Args:
            commit: A ChromiumCommit object.
            provisional: True if the commit is from a Gerrit in-flight CL,
                False if the commit has landed.
            pr_number: Optional, a PR issue number.
                If specified, updates the PR instead of creating one.
            pr_footer: Optional, additional text to be appended to PR
                description after the commit message.
            pr_branch_name: Optional, the name of the head branch of the PR.
                If unspecified, the current head branch of the PR will be used.

        Returns:
            The issue number (an int) of the updated/created PR, or None if no
            change is made.
        """ # Replace '<' with '\<', crbug.com/822278.
The issue number (an int) of the updated/created PR, or None if no
change is made.
The issue number ( an int ) of the updated / created PR or None if no change is made .
self
commit
A ChromiumCommit object.
A ChromiumCommit object .
provisional
True if the commit is from a Gerrit in-flight CL,
False if the commit has landed.
True if the commit is from a Gerrit in - flight CL False if the commit has landed .
pr_number
Optional, a PR issue number.
If specified, updates the PR instead of creating one.
Optional a PR issue number . If specified updates the PR instead of creating one .
pr_footer
Optional, additional text to be appended to PR
description after the commit message.
Optional additional text to be appended to PR description after the commit message .
pr_branch_name
Optional, the name of the head branch of the PR.
If unspecified, the current head branch of the PR will be used.
Optional the name of the head branch of the PR . If unspecified the current head branch of the PR will be used .