Skip to content

Commit

Permalink
Cherry-pick 262618@main (700cb2c). rdar://107271252
Browse files Browse the repository at this point in the history
    [git-webkit] Clarify fork relationship in creation prompt
    https://bugs.webkit.org/show_bug.cgi?id=254531
    rdar://107271252

    Reviewed by Aakash Jain.

    * Tools/Scripts/libraries/webkitscmpy/setup.py: Bump version.
    * Tools/Scripts/libraries/webkitscmpy/webkitscmpy/__init__.py: Ditto.
    * Tools/Scripts/libraries/webkitscmpy/webkitscmpy/program/setup.py:
    (Setup.github): Include both owner and repository name when describing the
    repository git-webkit is creating a fork of.
    * Tools/Scripts/libraries/webkitscmpy/webkitscmpy/test/setup_unittest.py:
    (TestSetup.test_github):

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

Canonical link: https://commits.webkit.org/259548.582@safari-7615-branch
  • Loading branch information
JonWBedard authored and webkit-early-warning-system committed Apr 6, 2023
1 parent 1698533 commit c730997
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Tools/Scripts/libraries/webkitscmpy/setup.py
Expand Up @@ -29,7 +29,7 @@ def readme():

setup(
name='webkitscmpy',
version='6.1.6',
version='6.1.7',
description='Library designed to interact with git and svn repositories.',
long_description=readme(),
classifiers=[
Expand Down
Expand Up @@ -46,7 +46,7 @@ def _maybe_add_webkitcorepy_path():
"Please install webkitcorepy with `pip install webkitcorepy --extra-index-url <package index URL>`"
)

version = Version(6, 1, 6)
version = Version(6, 1, 7)

AutoInstall.register(Package('fasteners', Version(0, 15, 0)))
AutoInstall.register(Package('jinja2', Version(2, 11, 3)))
Expand Down
15 changes: 10 additions & 5 deletions Tools/Scripts/libraries/webkitscmpy/webkitscmpy/program/setup.py
Expand Up @@ -102,10 +102,11 @@ def github(cls, args, repository, additional_setup=None, remote=None, team=None,
return result

if repository.owner == username or args.defaults or Terminal.choose(
"Create a private fork of '{}' belonging to '{}'".format(forked_name, username),
default='Yes',
"Create a private fork of '{}/{}' named '{}' belonging to '{}'".format(
repository.owner, repository.name, forked_name, username
), default='Yes',
) == 'No':
log.info("Continuing without forking '{}'".format(forked_name))
log.info("Continuing without forking '{}/{}'".format(repository.owner, repository.name))
return 1

data = dict(
Expand All @@ -121,7 +122,9 @@ def github(cls, args, repository, additional_setup=None, remote=None, team=None,
repository.name,
), json=data, auth=auth, headers=dict(Accept=repository.ACCEPT_HEADER))
if response.status_code // 100 != 2:
sys.stderr.write("Failed to create a fork of '{}' belonging to '{}'\n".format(forked_name, username))
sys.stderr.write("Failed to create a fork of '{}/{}' named '{}' belonging to '{}'\n".format(
repository.owner, repository.name, forked_name, username,
))
sys.stderr.write("URL: {}\nServer replied with status code {}:\n{}\n".format(response.url, response.status_code, response.text))
return 1

Expand All @@ -133,7 +136,9 @@ def github(cls, args, repository, additional_setup=None, remote=None, team=None,
set_name,
), json=dict(name=forked_name), auth=auth, headers=dict(Accept=repository.ACCEPT_HEADER))
if response.status_code // 100 != 2:
sys.stderr.write("Fork created with name '{}' belonging to '{}'\n Failed to change name to {}\n".format(set_name, username, forked_name))
sys.stderr.write("Fork of '{}/{}' created with name '{}' belonging to '{}'\n Failed to change name to {}\n".format(
repository.owner, repository.name, set_name, username, forked_name,
))
sys.stderr.write("URL: {}\nServer replied with status code {}:\n{}\n".format(response.url, response.status_code, response.text))
return 1

Expand Down
Expand Up @@ -62,7 +62,7 @@ def test_github(self):

self.assertEqual(
captured.stdout.getvalue(),
"Create a private fork of 'WebKit' belonging to 'username' ([Yes]/No): \n"
"Create a private fork of 'WebKit/WebKit' named 'WebKit' belonging to 'username' ([Yes]/No): \n"
'Setup succeeded!\n',
)
self.assertEqual(captured.stderr.getvalue(), '')
Expand Down Expand Up @@ -157,7 +157,7 @@ def test_github_checkout(self):
Pick a commit message editor for this repository:
{}
:
Create a private fork of 'WebKit' belonging to 'username' ([Yes]/No):
Create a private fork of 'WebKit/WebKit' named 'WebKit' belonging to 'username' ([Yes]/No):
Setup succeeded!
'''.format('\n '.join([
'{}) {}'.format(
Expand Down

0 comments on commit c730997

Please sign in to comment.