WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
Patch
bug-229625-20210827130443.patch (text/plain), 9.84 KB, created by
Jonathan Bedard
on 2021-08-27 13:04:44 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Jonathan Bedard
Created:
2021-08-27 13:04:44 PDT
Size:
9.84 KB
patch
obsolete
>Subversion Revision: 281714 >diff --git a/Tools/ChangeLog b/Tools/ChangeLog >index 6eb09e581ddef58883d3acbef00d720d4e09d1df..a1f5176a9a0f24da979e33239eecc7bd600abfe3 100644 >--- a/Tools/ChangeLog >+++ b/Tools/ChangeLog >@@ -1,3 +1,27 @@ >+2021-08-27 Jonathan Bedard <jbedard@apple.com> >+ >+ [git-webkit] Automatic rebasing or pull-requests >+ https://bugs.webkit.org/show_bug.cgi?id=229625 >+ <rdar://problem/82451030> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * Scripts/libraries/webkitscmpy/webkitscmpy/local/git.py: >+ (Git.pull): Add rebase and branch arguments. >+ * Scripts/libraries/webkitscmpy/webkitscmpy/program/pull.py: >+ (Pull): Add 'up' and 'update' aliases. >+ (Pull.main): Update the source branch of a pull-request branches. >+ * Scripts/libraries/webkitscmpy/webkitscmpy/program/pull_request.py: >+ (PullRequest.parser): Add --rebase/--no-rebase options. >+ (PullRequest.main): Update and rebase a pull-request on it's source branch. >+ * Scripts/libraries/webkitscmpy/webkitscmpy/test/pull_request_unittest.py: >+ (TestPullRequest.test_staged): >+ (TestPullRequest.test_modified): >+ (TestPullRequest.test_github): >+ (TestPullRequest.test_github_update): >+ (TestPullRequest.test_bitbucket): >+ (TestPullRequest.test_bitbucket_update): >+ > 2021-08-27 Chris Dumez <cdumez@apple.com> > > Extend API test coverage to make sure didFailProvisionalLoad is not called upon COOP process swap >diff --git a/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/local/git.py b/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/local/git.py >index ec4c9b67f5048aec47f16ec159f6c1843c68ff6a..ef139587f73167bda0f24ae0ae859a64e3abd573 100644 >--- a/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/local/git.py >+++ b/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/local/git.py >@@ -771,9 +771,14 @@ class Git(Scm): > cwd=self.root_path, > ).returncode else self.commit() > >- def pull(self): >- commit = self.commit() >- code = run([self.executable(), 'pull'], cwd=self.root_path).returncode >+ def pull(self, rebase=None, branch=None): >+ code = run( >+ [self.executable(), 'pull'] + ( >+ ['origin', branch] if branch else [] >+ ) + ( >+ [] if rebase is None else ['--rebase={}'.format('True' if rebase else 'False')] >+ ), cwd=self.root_path, >+ ).returncode > if not code and self.is_svn: > return run([ > self.executable(), 'svn', 'fetch', '--log-window-size=5000', '-r', '{}:HEAD'.format(commit.revision), >diff --git a/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/program/pull.py b/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/program/pull.py >index f7ea3657d7c3be4b6a1890ee3989be5237876d06..766d6125ae91d2f0827618f18269e922e7578131 100644 >--- a/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/program/pull.py >+++ b/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/program/pull.py >@@ -23,10 +23,13 @@ > import sys > > from .command import Command >+from .pull_request import PullRequest >+from webkitscmpy import local > > > class Pull(Command): > name = 'pull' >+ aliases = ['up', 'update'] > help = 'Update the current checkout, synchronize git-svn if configured' > > @classmethod >@@ -34,4 +37,8 @@ class Pull(Command): > if not repository.path: > sys.stderr.write('Cannot update remote repository\n') > return 1 >+ >+ if isinstance(repository, local.Git): >+ branch_point = PullRequest.branch_point(args, repository, **kwargs) >+ return repository.pull(rebase=True, branch=branch_point.branch) > return repository.pull() >diff --git a/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/program/pull_request.py b/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/program/pull_request.py >index 67475bf909e8f502f8ad628618496f98a6928094..7b0fc90326a6a8ecb0841638d98d16df141f1beb 100644 >--- a/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/program/pull_request.py >+++ b/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/program/pull_request.py >@@ -43,6 +43,12 @@ class PullRequest(Command): > help='When drafting a change, add (or never add) modified files to set of staged changes to be committed', > action=arguments.NoAction, > ) >+ parser.add_argument( >+ '--no-rebase', '--rebase', >+ dest='rebase', default=True, >+ help='Rebase the pull-request on the source branch before pushing', >+ action=arguments.NoAction, >+ ) > > @classmethod > def create_commit(cls, args, repository, **kwargs): >@@ -105,6 +111,12 @@ class PullRequest(Command): > return result > > branch_point = cls.branch_point(args, repository, **kwargs) >+ if args.rebase: >+ log.warning("Rebasing '{}' on '{}'...".format(repository.branch, branch_point.branch)) >+ if repository.pull(rebase=True, branch=branch_point.branch): >+ sys.stderr.write("Failed to rebase '{}' on '{},' please resolve conflicts\n".format(repository.branch, branch_point.branch)) >+ return 1 >+ log.warning("Rebased '{}' on '{}!'".format(repository.branch, branch_point.branch)) > > rmt = repository.remote() > if not rmt: >diff --git a/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/test/pull_request_unittest.py b/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/test/pull_request_unittest.py >index 3b06b1ce519eab17648f7a6dd5d9ac5b607ca2d0..56868a3a39775b7c5a3495e792776b3626a7ffac 100644 >--- a/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/test/pull_request_unittest.py >+++ b/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/test/pull_request_unittest.py >@@ -194,6 +194,8 @@ class TestDoPullRequest(testing.PathTestCase): > self.assertEqual(captured.root.log.getvalue(), '''Creating the local development branch 'eng/pr-branch'... > Creating commit... > Found 1 commit... >+Rebasing 'eng/pr-branch' on 'main'... >+Rebased 'eng/pr-branch' on 'main!' > ''') > self.assertEqual(captured.stderr.getvalue(), "'{}' doesn't have a recognized remote\n".format(self.path)) > >@@ -213,6 +215,8 @@ Creating commit... > Adding modified.txt... > Creating commit... > Found 1 commit... >+Rebasing 'eng/pr-branch' on 'main'... >+Rebased 'eng/pr-branch' on 'main!' > ''') > > def test_github(self): >@@ -228,10 +232,12 @@ Creating commit... > self.assertEqual(captured.stderr.getvalue(), '') > log = captured.root.log.getvalue().splitlines() > self.assertEqual( >- log[:4] + log[7 if sys.version_info > (3, 0) else 5:], [ >+ log[:6] + log[9 if sys.version_info > (3, 0) else 7:], [ > "Creating the local development branch 'eng/pr-branch'...", > 'Creating commit...', > ' Found 1 commit...', >+ "Rebasing 'eng/pr-branch' on 'main'...", >+ "Rebased 'eng/pr-branch' on 'main!'", > "Pushing 'eng/pr-branch' to 'fork'...", > "Creating pull-request for 'eng/pr-branch'...", > "Created 'PR 1 | Created commit'!", >@@ -257,16 +263,18 @@ Creating commit... > self.assertEqual(captured.stderr.getvalue(), '') > log = captured.root.log.getvalue().splitlines() > self.assertEqual( >- log[:3] + log[6 if sys.version_info > (3, 0) else 4:], [ >+ log[:5] + log[8 if sys.version_info > (3, 0) else 6:], [ > "Amending commit...", > ' Found 1 commit...', >+ "Rebasing 'eng/pr-branch' on 'main'...", >+ "Rebased 'eng/pr-branch' on 'main!'", > "Pushing 'eng/pr-branch' to 'fork'...", > "Updating pull-request for 'eng/pr-branch'...", > "Updated 'PR 1 | Amended commit'!", > ], > ) > >- def test_stash(self): >+ def test_bitbucket(self): > with OutputCapture() as captured, mocks.remote.BitBucket() as remote, mocks.local.Git(self.path, remote='ssh://git@{}/{}/{}.git'.format( > remote.hosts[0], remote.project.split('/')[1], remote.project.split('/')[3], > )) as repo, mocks.local.Svn(): >@@ -280,17 +288,19 @@ Creating commit... > self.assertEqual(captured.stderr.getvalue(), '') > log = captured.root.log.getvalue().splitlines() > self.assertEqual( >- log[:4] + log[7 if sys.version_info > (3, 0) else 5:], [ >+ log[:6] + log[9 if sys.version_info > (3, 0) else 7:], [ > "Creating the local development branch 'eng/pr-branch'...", > 'Creating commit...', > ' Found 1 commit...', >+ "Rebasing 'eng/pr-branch' on 'main'...", >+ "Rebased 'eng/pr-branch' on 'main!'", > "Pushing 'eng/pr-branch' to 'origin'...", > "Creating pull-request for 'eng/pr-branch'...", > "Created 'PR 1 | Created commit'!", > ], > ) > >- def test_stash_update(self): >+ def test_bitbucket_update(self): > with mocks.remote.BitBucket() as remote, mocks.local.Git(self.path, remote='ssh://git@{}/{}/{}.git'.format( > remote.hosts[0], remote.project.split('/')[1], remote.project.split('/')[3], > )) as repo, mocks.local.Svn(): >@@ -311,9 +321,11 @@ Creating commit... > self.assertEqual(captured.stderr.getvalue(), '') > log = captured.root.log.getvalue().splitlines() > self.assertEqual( >- log[:3] + log[6 if sys.version_info > (3, 0) else 4:], [ >+ log[:5] + log[8 if sys.version_info > (3, 0) else 6:], [ > "Amending commit...", > ' Found 1 commit...', >+ "Rebasing 'eng/pr-branch' on 'main'...", >+ "Rebased 'eng/pr-branch' on 'main!'", > "Pushing 'eng/pr-branch' to 'origin'...", > "Updating pull-request for 'eng/pr-branch'...", > "Updated 'PR 1 | Amended commit'!",
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 229625
:
436661
|
436807
|
436882
|
436931
|
437052
|
437055