Skip to content

Commit

Permalink
[git-webkit] Found branch name instead of hash
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=239296
<rdar://problem/91720224>

Reviewed by Michael Catanzaro.

* Tools/Scripts/libraries/webkitscmpy/setup.py: Bump version.
* Tools/Scripts/libraries/webkitscmpy/webkitscmpy/__init__.py: Ditto.
* Tools/Scripts/libraries/webkitscmpy/webkitscmpy/local/git.py:
(Git.Cache.populate): Add --no-decorate to `git log` command.
(Git.commit): Ditto.
(Git.commits): Ditto.
* Tools/Scripts/libraries/webkitscmpy/webkitscmpy/mocks/local/git.py:
* Tools/Scripts/libraries/webkitscmpy/webkitscmpy/test/git_unittest.py:
(TestGit.test_log): Ditto.

Canonical link: https://commits.webkit.org/249617@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@292844 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
JonWBedard committed Apr 13, 2022
1 parent 4d2f539 commit b7d3962
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 10 deletions.
18 changes: 18 additions & 0 deletions Tools/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
2022-04-13 Jonathan Bedard <jbedard@apple.com>

[git-webkit] Found branch name instead of hash
https://bugs.webkit.org/show_bug.cgi?id=239296
<rdar://problem/91720224>

Reviewed by Michael Catanzaro.

* Scripts/libraries/webkitscmpy/setup.py: Bump version.
* Scripts/libraries/webkitscmpy/webkitscmpy/__init__.py: Ditto.
* Scripts/libraries/webkitscmpy/webkitscmpy/local/git.py:
(Git.Cache.populate): Add --no-decorate to `git log` command.
(Git.commit): Ditto.
(Git.commits): Ditto.
* Scripts/libraries/webkitscmpy/webkitscmpy/mocks/local/git.py:
* Scripts/libraries/webkitscmpy/webkitscmpy/test/git_unittest.py:
(TestGit.test_log): Ditto.

2022-04-13 Ross Kirsling <ross.kirsling@sony.com>

Add PlayStation builds to bot watcher's dashboard.
Expand Down
2 changes: 1 addition & 1 deletion Tools/Scripts/libraries/webkitscmpy/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def readme():

setup(
name='webkitscmpy',
version='4.9.1',
version='4.9.2',
description='Library designed to interact with git and svn repositories.',
long_description=readme(),
classifiers=[
Expand Down
Original file line number Diff line number Diff line change
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(4, 9, 1)
version = Version(4, 9, 2)

AutoInstall.register(Package('fasteners', Version(0, 15, 0)))
AutoInstall.register(Package('jinja2', Version(2, 11, 3)))
Expand Down
6 changes: 3 additions & 3 deletions Tools/Scripts/libraries/webkitscmpy/webkitscmpy/local/git.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ def _append(branch, hash, revision=None):
kwargs = dict(encoding='utf-8')
self._last_populated[branch] = time.time()
log = subprocess.Popen(
[self.repo.executable(), 'log', branch],
[self.repo.executable(), 'log', branch, '--no-decorate'],
cwd=self.repo.root_path,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
Expand Down Expand Up @@ -560,7 +560,7 @@ def commit(self, hash=None, revision=None, identifier=None, branch=None, tag=Non

default_branch = self.default_branch
parsed_branch_point = None
log_format = ['-1'] if include_log else ['-1', '--format=short']
log_format = ['-1', '--no-decorate'] if include_log else ['-1', '--no-decorate', '--format=short']

# Determine the `git log` output and branch for a given identifier
if identifier is not None:
Expand Down Expand Up @@ -743,7 +743,7 @@ def commits(self, begin=None, end=None, include_log=True, include_identifier=Tru
try:
log = None
log = subprocess.Popen(
[self.executable(), 'log', '--format=fuller', '{}...{}'.format(end.hash, begin.hash)],
[self.executable(), 'log', '--format=fuller', '--no-decorate', '{}...{}'.format(end.hash, begin.hash)],
cwd=self.root_path,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ def __init__(
stdout='{}\n'.format(self.find(args[2]).hash),
) if self.find(args[2]) else mocks.ProcessCompletion(returncode=128)
), mocks.Subprocess.Route(
self.executable, 'log', re.compile(r'.+'), '-1',
self.executable, 'log', re.compile(r'.+'), '-1', '--no-decorate',
cwd=self.path,
generator=lambda *args, **kwargs: mocks.ProcessCompletion(
returncode=0,
Expand All @@ -283,7 +283,7 @@ def __init__(
),
) if self.find(args[2]) else mocks.ProcessCompletion(returncode=128),
), mocks.Subprocess.Route(
self.executable, 'log', '--format=fuller', re.compile(r'.+\.\.\..+'),
self.executable, 'log', '--format=fuller', '--no-decorate', re.compile(r'.+\.\.\..+'),
cwd=self.path,
generator=lambda *args, **kwargs: mocks.ProcessCompletion(
returncode=0,
Expand All @@ -306,7 +306,7 @@ def __init__(
os.path.basename(path),
commit.revision,
)] if git_svn else []),
)) for commit in list(self.commits_in_range(args[3].split('...')[-1], args[3].split('...')[0]))[:-1]
)) for commit in list(self.commits_in_range(args[4].split('...')[-1], args[4].split('...')[0]))[:-1]
])
)
), mocks.Subprocess.Route(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ def test_log(self):
with mocks.local.Git(self.path, git_svn=True):
self.assertEqual(
run([
local.Git.executable(), 'log', '--format=fuller', 'remotes/origin/main...1abe25b4',
local.Git.executable(), 'log', '--format=fuller', '--no-decorate', 'remotes/origin/main...1abe25b4',
], cwd=self.path, capture_output=True, encoding='utf-8').stdout,
'''commit d8bce26fa65c6fc8f39c17927abb77f69fab82fc
Author: Jonathan Bedard <jbedard@apple.com>
Expand Down Expand Up @@ -345,7 +345,7 @@ def test_branch_log(self):
with mocks.local.Git(self.path, git_svn=True):
self.assertEqual(
run([
local.Git.executable(), 'log', '--format=fuller', 'branch-b...main',
local.Git.executable(), 'log', '--format=fuller', '--no-decorate', 'branch-b...main',
], cwd=self.path, capture_output=True, encoding='utf-8').stdout,
'''commit 790725a6d79e28db2ecdde29548d2262c0bd059d
Author: Jonathan Bedard <jbedard@apple.com>
Expand Down

0 comments on commit b7d3962

Please sign in to comment.