Modified: trunk/Tools/Scripts/libraries/webkitscmpy/setup.py (289642 => 289643)
--- trunk/Tools/Scripts/libraries/webkitscmpy/setup.py 2022-02-11 19:47:46 UTC (rev 289642)
+++ trunk/Tools/Scripts/libraries/webkitscmpy/setup.py 2022-02-11 19:54:29 UTC (rev 289643)
@@ -29,7 +29,7 @@
setup(
name='webkitscmpy',
- version='4.1.0',
+ version='4.1.1',
description='Library designed to interact with git and svn repositories.',
long_description=readme(),
classifiers=[
Modified: trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/__init__.py (289642 => 289643)
--- trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/__init__.py 2022-02-11 19:47:46 UTC (rev 289642)
+++ trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/__init__.py 2022-02-11 19:54:29 UTC (rev 289643)
@@ -46,7 +46,7 @@
"Please install webkitcorepy with `pip install webkitcorepy --extra-index-url <package index URL>`"
)
-version = Version(4, 1, 0)
+version = Version(4, 1, 1)
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 (289642 => 289643)
--- trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/program/land.py 2022-02-11 19:47:46 UTC (rev 289642)
+++ trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/program/land.py 2022-02-11 19:54:29 UTC (rev 289643)
@@ -1,4 +1,4 @@
-# Copyright (C) 2021 Apple Inc. All rights reserved.
+# Copyright (C) 2021-2022 Apple Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
@@ -44,6 +44,15 @@
MIRROR_TIMEOUT = 60
@classmethod
+ def revert_branch(cls, repository, remote, branch):
+ if run(
+ [repository.executable(), 'branch', '-f', branch, 'remotes/{}/{}'.format(remote, branch)],
+ cwd=repository.root_path,
+ ).returncode:
+ return False
+ return True
+
+ @classmethod
def parser(cls, parser, loggers=None):
parser.add_argument(
'--no-force-review', '--force-review', '--no-review',
@@ -154,7 +163,7 @@
if run([repository.executable(), 'branch', '-f', target, source_branch], cwd=repository.root_path).returncode:
sys.stderr.write("Failed to move '{}' ref\n".format(target))
- return 1
+ return 1 if cls.revert_branch(repository, cls.REMOTE, target) else -1
if identifier_template:
repository.checkout(target)
@@ -162,9 +171,10 @@
identifier=True, remote=cls.REMOTE, number=len(commits),
), repository, identifier_template=identifier_template):
sys.stderr.write("Failed to embed identifiers to '{}'\n".format(target))
- return 1
+ return 1 if cls.revert_branch(repository, cls.REMOTE, target) else -1
if run([repository.executable(), 'branch', '-f', source_branch, target], cwd=repository.root_path).returncode:
sys.stderr.write("Failed to move '{}' ref to the canonicalized head of '{}'\n".format(source, target))
+ cls.revert_branch(repository, cls.REMOTE, target)
return -1
# Need to compute the remote source
@@ -173,10 +183,10 @@
if canonical_svn:
if run([repository.executable(), 'svn', 'fetch'], cwd=repository.root_path).returncode:
sys.stderr.write("Failed to update subversion refs\n".format(target))
- return 1
+ return 1 if cls.revert_branch(repository, cls.REMOTE, target) else -1
if run([repository.executable(), 'svn', 'dcommit'], cwd=repository.root_path).returncode:
sys.stderr.write("Failed to commit '{}' to Subversion remote\n".format(target))
- return 1
+ return 1 if cls.revert_branch(repository, cls.REMOTE, target) else -1
run([repository.executable(), 'reset', 'HEAD~{}'.format(len(commits)), '--hard'], cwd=repository.root_path)
# Verify the mirror processed our change
@@ -218,7 +228,7 @@
if run([repository.executable(), 'push', cls.REMOTE, target], cwd=repository.root_path).returncode:
sys.stderr.write("Failed to push '{}' to '{}'\n".format(target, cls.REMOTE))
- return 1
+ return 1 if cls.revert_branch(repository, cls.REMOTE, target) else -1
repository.checkout(target)
commit = repository.commit(branch=target, include_log=False)