File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed
cherry_picker/cherry_picker Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -421,8 +421,16 @@ def get_base_branch(cherry_pick_branch):
421
421
422
422
if prefix != 'backport' :
423
423
raise ValueError ('branch name is not prefixed with "backport-". Is this a cherry_picker branch?' )
424
+
424
425
if not re .match ('[0-9a-f]{7,40}' , sha ):
425
- raise ValueError ('branch name has an invalid sha' )
426
+ raise ValueError (f'branch name has an invalid sha: { sha } ' )
427
+
428
+ cmd = ['git' , 'log' , '-r' , sha ]
429
+ try :
430
+ subprocess .check_output (cmd , stderr = subprocess .STDOUT )
431
+ except subprocess .SubprocessError :
432
+ raise ValueError (f'The sha listed in the branch name, { sha } , is not present in the repository' )
433
+
426
434
# Subject the parsed base_branch to the same tests as when we generated it
427
435
# This throws a ValueError if the base_branch doesn't need our requirements
428
436
version_from_branch (base_branch )
You can’t perform that action at this time.
0 commit comments