- Revision
- 271455
- Author
- [email protected]
- Date
- 2021-01-13 14:33:10 -0800 (Wed, 13 Jan 2021)
Log Message
[webkitscmpy] Handle single commit touching multiple branches
https://bugs.webkit.org/show_bug.cgi?id=220601
<rdar://problem/73165609>
Reviewed by Stephanie Lewis.
In WebKit's history, there are a few cases of commits that touch multiple branches (like
https://trac.webkit.org/changeset/92419/webkit). These types of commits are not correct,
but we need to handle them if they are in the history of a branch.
* Scripts/libraries/webkitscmpy/setup.py: Bump version.
* Scripts/libraries/webkitscmpy/webkitscmpy/__init__.py: Ditto.
* Scripts/libraries/webkitscmpy/webkitscmpy/local/svn.py:
(Svn._cache_revisions): Branches only intersect trunk when two sequential commits are from trunk.
(Svn.commit): Support case where no commit time can be found.
* Scripts/libraries/webkitscmpy/webkitscmpy/remote/svn.py:
(Svn._cache_revisions): Branches only intersect trunk when two sequential commits are from trunk.
(Svn.commit): Support case where no commit time can be found.
Modified Paths
Diff
Modified: trunk/Tools/ChangeLog (271454 => 271455)
--- trunk/Tools/ChangeLog 2021-01-13 21:38:36 UTC (rev 271454)
+++ trunk/Tools/ChangeLog 2021-01-13 22:33:10 UTC (rev 271455)
@@ -1,3 +1,24 @@
+2021-01-13 Jonathan Bedard <[email protected]>
+
+ [webkitscmpy] Handle single commit touching multiple branches
+ https://bugs.webkit.org/show_bug.cgi?id=220601
+ <rdar://problem/73165609>
+
+ Reviewed by Stephanie Lewis.
+
+ In WebKit's history, there are a few cases of commits that touch multiple branches (like
+ https://trac.webkit.org/changeset/92419/webkit). These types of commits are not correct,
+ but we need to handle them if they are in the history of a branch.
+
+ * Scripts/libraries/webkitscmpy/setup.py: Bump version.
+ * Scripts/libraries/webkitscmpy/webkitscmpy/__init__.py: Ditto.
+ * Scripts/libraries/webkitscmpy/webkitscmpy/local/svn.py:
+ (Svn._cache_revisions): Branches only intersect trunk when two sequential commits are from trunk.
+ (Svn.commit): Support case where no commit time can be found.
+ * Scripts/libraries/webkitscmpy/webkitscmpy/remote/svn.py:
+ (Svn._cache_revisions): Branches only intersect trunk when two sequential commits are from trunk.
+ (Svn.commit): Support case where no commit time can be found.
+
2021-01-13 Aakash Jain <[email protected]>
[build.webkit.org] Use PostgreSQL for new build.webkit.org database
Modified: trunk/Tools/Scripts/libraries/webkitscmpy/setup.py (271454 => 271455)
--- trunk/Tools/Scripts/libraries/webkitscmpy/setup.py 2021-01-13 21:38:36 UTC (rev 271454)
+++ trunk/Tools/Scripts/libraries/webkitscmpy/setup.py 2021-01-13 22:33:10 UTC (rev 271455)
@@ -30,7 +30,7 @@
setup(
name='webkitscmpy',
- version='0.8.0',
+ version='0.8.1',
description='Library designed to interact with git and svn repositories.',
long_description=readme(),
classifiers=[
Modified: trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/__init__.py (271454 => 271455)
--- trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/__init__.py 2021-01-13 21:38:36 UTC (rev 271454)
+++ trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/__init__.py 2021-01-13 22:33:10 UTC (rev 271455)
@@ -46,7 +46,7 @@
"Please install webkitcorepy with `pip install webkitcorepy --extra-index-url <package index URL>`"
)
-version = Version(0, 8, 0)
+version = Version(0, 8, 1)
AutoInstall.register(Package('fasteners', Version(0, 15, 0)))
AutoInstall.register(Package('monotonic', Version(1, 5)))
Modified: trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/local/svn.py (271454 => 271455)
--- trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/local/svn.py 2021-01-13 21:38:36 UTC (rev 271454)
+++ trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/local/svn.py 2021-01-13 22:33:10 UTC (rev 271455)
@@ -164,6 +164,7 @@
if log.poll():
raise self.Exception("Failed to construct branch history for '{}'".format(branch))
+ was_last_on_default = False
line = log.stdout.readline()
while line:
match = self.LOG_RE.match(line)
@@ -179,8 +180,11 @@
break
if not is_default_branch:
if revision in self._metadata_cache[self.default_branch]:
- self._metadata_cache[branch].insert(pos, revision)
- break
+ if was_last_on_default:
+ break
+ was_last_on_default = True
+ else:
+ was_last_on_default = False
self._metadata_cache[branch].insert(pos, revision)
line = log.stdout.readline()
finally:
@@ -326,13 +330,14 @@
if branch != self.default_branch:
branch = self._branch_for(revision)
- date = info['Last Changed Date'].split(' (')[0]
- tz_diff = date.split(' ')[-1]
- date = datetime.strptime(date[:-len(tz_diff)], '%Y-%m-%d %H:%M:%S ')
- date += timedelta(
- hours=int(tz_diff[1:3]),
- minutes=int(tz_diff[3:5]),
- ) * (1 if tz_diff[0] == '-' else -1)
+ date = info['Last Changed Date'].split(' (')[0] if info.get('Last Changed Date') else None
+ if date:
+ tz_diff = date.split(' ')[-1]
+ date = datetime.strptime(date[:-len(tz_diff)], '%Y-%m-%d %H:%M:%S ')
+ date += timedelta(
+ hours=int(tz_diff[1:3]),
+ minutes=int(tz_diff[3:5]),
+ ) * (1 if tz_diff[0] == '-' else -1)
if not identifier:
if branch != self.default_branch and revision > self._metadata_cache.get(self.default_branch, [0])[-1]:
@@ -376,7 +381,7 @@
branch=branch,
identifier=identifier,
branch_point=branch_point,
- timestamp=int(calendar.timegm(date.timetuple())),
+ timestamp=int(calendar.timegm(date.timetuple())) if date else None,
author=author,
message=message,
)
Modified: trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/remote/svn.py (271454 => 271455)
--- trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/remote/svn.py 2021-01-13 21:38:36 UTC (rev 271454)
+++ trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/remote/svn.py 2021-01-13 22:33:10 UTC (rev 271455)
@@ -232,6 +232,7 @@
if response.status_code != 200:
raise self.Exception("Failed to construct branch history for '{}'".format(branch))
+ was_last_on_default = False
for line in response.iter_lines():
match = self.HISTORY_RE.match(line)
if not match:
@@ -248,8 +249,11 @@
break
if not is_default_branch:
if revision in self._metadata_cache[self.default_branch]:
- self._metadata_cache[branch].insert(pos, revision)
- break
+ if was_last_on_default:
+ break
+ was_last_on_default = True
+ else:
+ was_last_on_default = False
self._metadata_cache[branch].insert(pos, revision)
if self._metadata_cache[self.default_branch][0] == [0]:
@@ -386,7 +390,7 @@
if branch != self.default_branch:
branch = self._branch_for(revision)
- date = datetime.strptime(info['Last Changed Date'], '%Y-%m-%d %H:%M:%S')
+ date = datetime.strptime(info['Last Changed Date'], '%Y-%m-%d %H:%M:%S') if info.get('Last Changed Date') else None
if not identifier:
if branch != self.default_branch and revision > self._metadata_cache.get(self.default_branch, [0])[-1]:
@@ -433,7 +437,7 @@
branch=branch,
identifier=identifier,
branch_point=branch_point,
- timestamp=int(calendar.timegm(date.timetuple())),
+ timestamp=int(calendar.timegm(date.timetuple())) if date else None,
author=author,
message=message,
)