Diff
Modified: trunk/Tools/ChangeLog (287852 => 287853)
--- trunk/Tools/ChangeLog 2022-01-10 20:18:37 UTC (rev 287852)
+++ trunk/Tools/ChangeLog 2022-01-10 21:09:28 UTC (rev 287853)
@@ -1,3 +1,19 @@
+2021-12-17 Jonathan Bedard <[email protected]>
+
+ [git-webkit] Retain old commits in pull-request
+ https://bugs.webkit.org/show_bug.cgi?id=234453
+ <rdar://problem/86654956>
+
+ Reviewed by Dewei Zhu.
+
+ * Scripts/libraries/webkitscmpy/setup.py: Bump version.
+ * Scripts/libraries/webkitscmpy/webkitscmpy/__init__.py: Ditto.
+ * Scripts/libraries/webkitscmpy/webkitscmpy/program/land.py:
+ (Land.main): Find all numbered branches for landing pull-request.
+ * Scripts/libraries/webkitscmpy/webkitscmpy/program/pull_request.py:
+ (PullRequest.parser): Add history option.
+ (PullRequest.main): Add a numbered branch which persists through the life of the pull-request.
+
2022-01-10 Wenson Hsieh <[email protected]>
Modal container observer fails detection when rendered text is inserted after the container
Modified: trunk/Tools/Scripts/libraries/webkitscmpy/setup.py (287852 => 287853)
--- trunk/Tools/Scripts/libraries/webkitscmpy/setup.py 2022-01-10 20:18:37 UTC (rev 287852)
+++ trunk/Tools/Scripts/libraries/webkitscmpy/setup.py 2022-01-10 21:09:28 UTC (rev 287853)
@@ -29,7 +29,7 @@
setup(
name='webkitscmpy',
- version='3.0.7',
+ version='3.1.0',
description='Library designed to interact with git and svn repositories.',
long_description=readme(),
classifiers=[
Modified: trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/__init__.py (287852 => 287853)
--- trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/__init__.py 2022-01-10 20:18:37 UTC (rev 287852)
+++ trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/__init__.py 2022-01-10 21:09:28 UTC (rev 287853)
@@ -46,7 +46,7 @@
"Please install webkitcorepy with `pip install webkitcorepy --extra-index-url <package index URL>`"
)
-version = Version(3, 0, 7)
+version = Version(3, 1, 0)
AutoInstall.register(Package('fasteners', Version(0, 15, 0)))
AutoInstall.register(Package('jinja2', Version(2, 11, 3)))
Modified: trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/program/land.py (287852 => 287853)
--- trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/program/land.py 2022-01-10 20:18:37 UTC (rev 287852)
+++ trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/program/land.py 2022-01-10 21:09:28 UTC (rev 287853)
@@ -232,6 +232,9 @@
pull_request.comment(land_message)
if args.defaults or Terminal.choose("Delete branch '{}'?".format(source_branch), default='Yes') == 'Yes':
- run([repository.executable(), 'branch', '-D', source_branch], cwd=repository.root_path)
- run([repository.executable(), 'push', remote_target, '--delete', source_branch], cwd=repository.root_path)
+ regex = re.compile(r'^{}-(?P<count>\d+)$'.format(repository.branch))
+ for to_delete in repository.branches_for(remote='fork'):
+ if to_delete == source_branch or regex.match(to_delete):
+ run([repository.executable(), 'branch', '-D', to_delete], cwd=repository.root_path)
+ run([repository.executable(), 'push', remote_target, '--delete', to_delete], cwd=repository.root_path)
return 0
Modified: trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/program/pull_request.py (287852 => 287853)
--- trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/program/pull_request.py 2022-01-10 20:18:37 UTC (rev 287852)
+++ trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/program/pull_request.py 2022-01-10 21:09:28 UTC (rev 287853)
@@ -21,6 +21,7 @@
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import os
+import re
import sys
from .command import Command
@@ -54,6 +55,12 @@
'--defaults', '--no-defaults', action="" default=None,
help='Do not prompt the user for defaults, always use (or do not use) them',
)
+ parser.add_argument(
+ '--with-history', '--no-history',
+ dest='history', default=None,
+ help='Create numbered branches to track the history of a change',
+ action=""
+ )
@classmethod
def create_commit(cls, args, repository, **kwargs):
@@ -131,6 +138,22 @@
sys.stderr.write("Failed to push '{}' to '{}'\n".format(repository.branch, target))
return 1
+ if args.history or (target != 'origin' and args.history is None):
+ regex = re.compile(r'^{}-(?P<count>\d+)$'.format(repository.branch))
+ count = max([
+ int(regex.match(branch).group('count')) if regex.match(branch) else 0 for branch in
+ repository.branches_for(remote=target)
+ ] + [0]) + 1
+
+ history_branch = '{}-{}'.format(repository.branch, count)
+ log.info("Creating '{}' as a reference branch".format(history_branch))
+ if run([
+ repository.executable(), 'branch', history_branch, repository.branch,
+ ], cwd=repository.root_path).returncode or run([
+ repository.executable(), 'push', '-f', target, history_branch,
+ ], cwd=repository.root_path).returncode:
+ sys.stderr.write("Failed to create and push '{}' to '{}'\n".format(history_branch, target))
+
if not rmt.pull_requests:
sys.stderr.write("'{}' cannot generate pull-requests\n".format(rmt.url))
return 1
Modified: trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/test/pull_request_unittest.py (287852 => 287853)
--- trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/test/pull_request_unittest.py 2022-01-10 20:18:37 UTC (rev 287852)
+++ trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/test/pull_request_unittest.py 2022-01-10 21:09:28 UTC (rev 287853)
@@ -322,7 +322,7 @@
repo.staged['added.txt'] = 'added'
self.assertEqual(0, program.main(
- args=('pull-request', '-i', 'pr-branch', '-v'),
+ args=('pull-request', '-i', 'pr-branch', '-v', '--no-history'),
path=self.path,
))
@@ -358,7 +358,7 @@
with OutputCapture(level=logging.INFO) as captured:
repo.staged['added.txt'] = 'diff'
self.assertEqual(0, program.main(
- args=('pull-request', '-v'),
+ args=('pull-request', '-v', '--no-history'),
path=self.path,
))
@@ -392,7 +392,7 @@
with OutputCapture(level=logging.INFO) as captured, MockTerminal.input('n'):
repo.staged['added.txt'] = 'diff'
self.assertEqual(0, program.main(
- args=('pull-request', '-v'),
+ args=('pull-request', '-v', '--no-history'),
path=self.path,
))