Title: [292890] trunk/Tools
Revision
292890
Author
[email protected]
Date
2022-04-14 14:15:31 -0700 (Thu, 14 Apr 2022)

Log Message

[git-webkit] Personal branch is "not a PR branch"
https://bugs.webkit.org/show_bug.cgi?id=239329
<rdar://problem/91756286>

Reviewed by Yusuke Suzuki.

* Tools/Scripts/libraries/webkitscmpy/setup.py: Bump version.
* Tools/Scripts/libraries/webkitscmpy/webkitscmpy/__init__.py: Ditto.
* Tools/Scripts/libraries/webkitscmpy/webkitscmpy/local/git.py:
(Git.branches_for): Provide optional caching.
* Tools/Scripts/libraries/webkitscmpy/webkitscmpy/program/branch.py:
(Branch.editable): If a branch does not exist on production remotes, that branch
should also be considered a PR branch.
* Tools/Scripts/libraries/webkitscmpy/webkitscmpy/program/pull_request.py:
(PullRequest.main): Only create a new PR branch if the current branch is a
production branch.

Canonical link: https://commits.webkit.org/249660@main

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (292889 => 292890)


--- trunk/Tools/ChangeLog	2022-04-14 21:00:59 UTC (rev 292889)
+++ trunk/Tools/ChangeLog	2022-04-14 21:15:31 UTC (rev 292890)
@@ -1,3 +1,22 @@
+2022-04-14  Jonathan Bedard  <[email protected]>
+
+        [git-webkit] Personal branch is "not a PR branch"
+        https://bugs.webkit.org/show_bug.cgi?id=239329
+        <rdar://problem/91756286>
+
+        Reviewed by Yusuke Suzuki.
+
+        * Scripts/libraries/webkitscmpy/setup.py: Bump version.
+        * Scripts/libraries/webkitscmpy/webkitscmpy/__init__.py: Ditto.
+        * Scripts/libraries/webkitscmpy/webkitscmpy/local/git.py:
+        (Git.branches_for): Provide optional caching.
+        * Scripts/libraries/webkitscmpy/webkitscmpy/program/branch.py:
+        (Branch.editable): If a branch does not exist on production remotes, that branch
+        should also be considered a PR branch.
+        * Scripts/libraries/webkitscmpy/webkitscmpy/program/pull_request.py:
+        (PullRequest.main): Only create a new PR branch if the current branch is a
+        production branch.
+
 2022-04-14  Wenson Hsieh  <[email protected]>
 
         [iOS] [WK2] Managed pasteboard should function for all managed domains

Modified: trunk/Tools/Scripts/libraries/webkitscmpy/setup.py (292889 => 292890)


--- trunk/Tools/Scripts/libraries/webkitscmpy/setup.py	2022-04-14 21:00:59 UTC (rev 292889)
+++ trunk/Tools/Scripts/libraries/webkitscmpy/setup.py	2022-04-14 21:15:31 UTC (rev 292890)
@@ -29,7 +29,7 @@
 
 setup(
     name='webkitscmpy',
-    version='4.9.2',
+    version='4.9.3',
     description='Library designed to interact with git and svn repositories.',
     long_description=readme(),
     classifiers=[

Modified: trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/__init__.py (292889 => 292890)


--- trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/__init__.py	2022-04-14 21:00:59 UTC (rev 292889)
+++ trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/__init__.py	2022-04-14 21:15:31 UTC (rev 292890)
@@ -46,7 +46,7 @@
         "Please install webkitcorepy with `pip install webkitcorepy --extra-index-url <package index URL>`"
     )
 
-version = Version(4, 9, 2)
+version = Version(4, 9, 3)
 
 AutoInstall.register(Package('fasteners', Version(0, 15, 0)))
 AutoInstall.register(Package('jinja2', Version(2, 11, 3)))

Modified: trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/local/git.py (292889 => 292890)


--- trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/local/git.py	2022-04-14 21:00:59 UTC (rev 292889)
+++ trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/local/git.py	2022-04-14 21:15:31 UTC (rev 292890)
@@ -505,6 +505,7 @@
             raise self.Exception('Failed to retrieve revision count for {}'.format(native_parameter))
         return int(revision_count.stdout)
 
+    @decorators.Memoize(cached=False)
     def branches_for(self, hash=None, remote=True):
         branch = run(
             [self.executable(), 'branch'] + (['--contains', hash] if hash else ['-a']),

Modified: trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/program/branch.py (292889 => 292890)


--- trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/program/branch.py	2022-04-14 21:00:59 UTC (rev 292889)
+++ trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/program/branch.py	2022-04-14 21:15:31 UTC (rev 292890)
@@ -54,8 +54,19 @@
     def editable(cls, branch, repository=None):
         if (repository or local.Scm).DEV_BRANCHES.match(branch):
             return True
-        return False
+        if branch in (repository or local.Scm).DEFAULT_BRANCHES:
+            return False
+        if (repository or local.Scm).PROD_BRANCHES.match(branch):
+            return False
+        if not repository or not isinstance(repository, local.Git):
+            return False
 
+        # FIXME: Need to consider alternate remotes
+        for remote in ['origin']:
+            if branch in repository.branches_for(remote=remote, cached=True):
+                return False
+        return True
+
     @classmethod
     def branch_point(cls, repository):
         cnt = 0

Modified: trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/program/pull_request.py (292889 => 292890)


--- trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/program/pull_request.py	2022-04-14 21:00:59 UTC (rev 292889)
+++ trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/program/pull_request.py	2022-04-14 21:15:31 UTC (rev 292890)
@@ -136,7 +136,7 @@
             sys.stderr.write('History retention was requested, but repository configuration forbids it\n')
             return 1
 
-        if not repository.DEV_BRANCHES.match(repository.branch):
+        if repository.branch in repository.DEFAULT_BRANCHES or repository.PROD_BRANCHES.match(repository.branch):
             if Branch.main(args, repository, why="'{}' is not a pull request branch".format(repository.branch), **kwargs):
                 sys.stderr.write("Abandoning pushing pull-request because '{}' could not be created\n".format(args.issue))
                 return 1
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to