Diff
Modified: trunk/Tools/ChangeLog (285157 => 285158)
--- trunk/Tools/ChangeLog 2021-11-02 14:56:44 UTC (rev 285157)
+++ trunk/Tools/ChangeLog 2021-11-02 15:11:06 UTC (rev 285158)
@@ -1,3 +1,17 @@
+2021-11-02 Jonathan Bedard <jbed...@apple.com>
+
+ [webkitscmpy] Generalize pull-request title generation.
+ https://bugs.webkit.org/show_bug.cgi?id=232463
+ <rdar://problem/84784354>
+
+ Reviewed by Dewei Zhu.
+
+ * Scripts/libraries/webkitscmpy/setup.py: Bump version.
+ * Scripts/libraries/webkitscmpy/webkitscmpy/__init__.py: Ditto.
+ * Scripts/libraries/webkitscmpy/webkitscmpy/program/pull_request.py:
+ (PullRequest.title_for): Compute pull-request title for a set of commits.
+ (PullRequest.main): Generalize pull-request title generation.
+
2021-11-02 Zixing Liu <liushuyu...@gmail.com>
[GTK][WPE] Support setting status code and getting HTTP method in custom URI scheme handlers
Modified: trunk/Tools/Scripts/libraries/webkitscmpy/setup.py (285157 => 285158)
--- trunk/Tools/Scripts/libraries/webkitscmpy/setup.py 2021-11-02 14:56:44 UTC (rev 285157)
+++ trunk/Tools/Scripts/libraries/webkitscmpy/setup.py 2021-11-02 15:11:06 UTC (rev 285158)
@@ -29,7 +29,7 @@
setup(
name='webkitscmpy',
- version='2.2.22',
+ version='2.2.23',
description='Library designed to interact with git and svn repositories.',
long_description=readme(),
classifiers=[
Modified: trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/__init__.py (285157 => 285158)
--- trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/__init__.py 2021-11-02 14:56:44 UTC (rev 285157)
+++ trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/__init__.py 2021-11-02 15:11:06 UTC (rev 285158)
@@ -46,7 +46,7 @@
"Please install webkitcorepy with `pip install webkitcorepy --extra-index-url <package index URL>`"
)
-version = Version(2, 2, 22)
+version = Version(2, 2, 23)
AutoInstall.register(Package('fasteners', Version(0, 15, 0)))
AutoInstall.register(Package('jinja2', Version(2, 11, 3)))
Modified: trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/program/pull_request.py (285157 => 285158)
--- trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/program/pull_request.py 2021-11-02 14:56:44 UTC (rev 285157)
+++ trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/program/pull_request.py 2021-11-02 15:11:06 UTC (rev 285158)
@@ -20,6 +20,7 @@
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+import os
import sys
from .command import Command
@@ -82,6 +83,14 @@
return 0
@classmethod
+ def title_for(cls, commits):
+ title = os.path.commonprefix([commit.message.splitlines()[0] for commit in commits])
+ if not title:
+ title = commits[0].message.splitlines()[0]
+ title = title.rstrip().lstrip()
+ return title[:-5].rstrip() if title.endswith('(Part') else title
+
+ @classmethod
def main(cls, args, repository, **kwargs):
if not isinstance(repository, local.Git):
sys.stderr.write("Can only '{}' on a native Git repository\n".format(cls.name))
@@ -121,26 +130,14 @@
if not rmt.pull_requests:
sys.stderr.write("'{}' cannot generate pull-requests\n".format(rmt.url))
return 1
- user, _ = rmt.credentials(required=True) if isinstance(rmt, remote.GitHub) else (repository.config()['user.email'], None)
candidates = list(rmt.pull_requests.find(opened=None, head=repository.branch))
commits = list(repository.commits(begin=dict(hash=branch_point.hash), end=dict(branch=repository.branch)))
- title = commits[0].message.splitlines()[0]
- for commit in commits[1:]:
- title_candidate = commit.message.splitlines()[0]
- while title and not title_candidate.startswith(title):
- title = title[:-1]
- if not title:
- title = commits[0].message.splitlines()[0]
- title = title.rstrip().lstrip()
- if title.endswith('(Part'):
- title = title[:-5].rstrip()
-
if candidates:
log.warning("Updating pull-request for '{}'...".format(repository.branch))
pr = rmt.pull_requests.update(
pull_request=candidates[0],
- title=title,
+ title=cls.title_for(commits),
commits=commits,
base=branch_point.branch,
head=repository.branch,
@@ -152,7 +149,7 @@
else:
log.warning("Creating pull-request for '{}'...".format(repository.branch))
pr = rmt.pull_requests.create(
- title=title,
+ title=cls.title_for(commits),
commits=commits,
base=branch_point.branch,
head=repository.branch,