Skip to content
Permalink
Browse files
[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
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@292890 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
JonWBedard committed Apr 14, 2022
1 parent 940b17a commit e253600fec5a20620bc27fb2708a06b2f3331ea9
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 4 deletions.
@@ -1,3 +1,22 @@
2022-04-14 Jonathan Bedard <jbedard@apple.com>

[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 <wenson_hsieh@apple.com>

[iOS] [WK2] Managed pasteboard should function for all managed domains
@@ -29,7 +29,7 @@ def readme():

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=[
@@ -46,7 +46,7 @@ def _maybe_add_webkitcorepy_path():
"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)))
@@ -505,6 +505,7 @@ def _commit_count(self, native_parameter):
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']),
@@ -54,7 +54,18 @@ def normalize_branch_name(cls, name, repository=None):
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):
@@ -136,7 +136,7 @@ def main(cls, args, repository, **kwargs):
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

0 comments on commit e253600

Please sign in to comment.