Changeset 274483 in webkit
- Timestamp:
- Mar 16, 2021, 9:34:00 AM (6 years ago)
- Location:
- trunk/Tools
- Files:
-
- 5 edited
-
ChangeLog (modified) (1 diff)
-
Scripts/libraries/webkitscmpy/setup.py (modified) (1 diff)
-
Scripts/libraries/webkitscmpy/webkitscmpy/__init__.py (modified) (1 diff)
-
Scripts/libraries/webkitscmpy/webkitscmpy/commit.py (modified) (3 diffs)
-
Scripts/libraries/webkitscmpy/webkitscmpy/test/commit_unittest.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Tools/ChangeLog
r274481 r274483 1 2021-03-16 Jonathan Bedard <jbedard@apple.com> 2 3 [webkitscmpy] Decode multiple commit representations 4 https://bugs.webkit.org/show_bug.cgi?id=223224 5 <rdar://problem/75455129> 6 7 Reviewed by Dewei Zhu. 8 9 * Scripts/libraries/webkitscmpy/setup.py: Bump version. 10 * Scripts/libraries/webkitscmpy/webkitscmpy/__init__.py: Ditto. 11 * Scripts/libraries/webkitscmpy/webkitscmpy/commit.py: 12 (Commit.from_json): Decode old results database style commit representations. 13 * Scripts/libraries/webkitscmpy/webkitscmpy/test/commit_unittest.py: 14 1 15 2021-03-16 Dean Johnson <dean_johnson@apple.com> 2 16 -
trunk/Tools/Scripts/libraries/webkitscmpy/setup.py
r274251 r274483 30 30 setup( 31 31 name='webkitscmpy', 32 version='0.13. 1',32 version='0.13.2', 33 33 description='Library designed to interact with git and svn repositories.', 34 34 long_description=readme(), -
trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/__init__.py
r274251 r274483 47 47 ) 48 48 49 version = Version(0, 13, 1)49 version = Version(0, 13, 2) 50 50 51 51 AutoInstall.register(Package('fasteners', Version(0, 15, 0))) -
trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/commit.py
r274080 r274483 147 147 return None 148 148 149 @classmethod 150 def from_json(cls, data): 151 data = data if isinstance(data, dict) else json.loads(data) 152 hash_from_id = None 153 revision_from_id = cls._parse_revision(data.get('id')) 154 if not revision_from_id: 155 hash_from_id = cls._parse_hash(data.get('id')) 156 157 return cls( 158 repository_id=data.get('repository_id'), 159 branch=data.get('branch'), 160 hash=data.get('hash', hash_from_id), 161 revision=data.get('revision', revision_from_id), 162 timestamp=data.get('timestamp'), 163 identifier=data.get('identifier'), 164 branch_point=data.get('branch_point'), 165 order=data.get('order'), 166 author=data.get('author', data.get('committer')), 167 message=data.get('message'), 168 ) 169 149 170 def __init__( 150 171 self, … … 185 206 ) 186 207 208 if isinstance(timestamp, six.string_types) and timestamp.isdigit(): 209 timestamp = int(timestamp) 187 210 if timestamp and not isinstance(timestamp, int): 188 211 raise TypeError("Expected 'timestamp' to be of type int, got '{}'".format(timestamp)) 189 212 self.timestamp = timestamp 190 213 214 if isinstance(order, six.string_types) and order.isdigit(): 215 order = int(order) 191 216 if order and not isinstance(order, int): 192 217 raise TypeError("Expected 'order' to be of type int, got '{}'".format(order)) … … 195 220 if author and isinstance(author, dict) and author.get('name'): 196 221 self.author = Contributor(author.get('name'), author.get('emails')) 222 elif author and isinstance(author, six.string_types) and '@' in author: 223 self.author = Contributor(author, author) 197 224 elif author and not isinstance(author, Contributor): 198 225 raise TypeError("Expected 'author' to be of type {}, got '{}'".format(Contributor, author)) -
trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/test/commit_unittest.py
r273765 r274483 254 254 255 255 self.assertEqual(commit_a, commit_b) 256 257 def test_from_json(self): 258 self.assertEqual( 259 Commit.from_json(dict( 260 repository_id='webkit', 261 id=1234, 262 timestamp=1000, 263 )), Commit( 264 repository_id='webkit', 265 revision=1234, 266 timestamp=1000, 267 ), 268 ) 269 270 self.assertEqual( 271 Commit.from_json(dict( 272 repository_id='webkit', 273 id='c3bd784f8b88bd03f64467ddd3304ed8be28acbe', 274 timestamp=2000, 275 )), Commit( 276 repository_id='webkit', 277 hash='c3bd784f8b88bd03f64467ddd3304ed8be28acbe', 278 timestamp=2000, 279 ), 280 ) 281 282 def test_from_json_str(self): 283 contributor = Contributor.from_scm_log('Author: jbedard@apple.com <jbedard@apple.com>') 284 self.assertEqual( 285 Commit.from_json('''{ 286 "revision": 1, 287 "hash": "c3bd784f8b88bd03f64467ddd3304ed8be28acbe", 288 "identifier": "1@main", 289 "timestamp": 1000, 290 "author": "jbedard@apple.com", 291 "message": "Message" 292 }'''), Commit( 293 revision=1, 294 hash='c3bd784f8b88bd03f64467ddd3304ed8be28acbe', 295 identifier='1@main', 296 timestamp=1000, 297 author=Contributor.Encoder().default(contributor), 298 message='Message' 299 ), 300 )
Note:
See TracChangeset
for help on using the changeset viewer.