@@ -73,6 +73,8 @@ def _ns(
7373 local_branch : str | None = None ,
7474 from_ref : str | None = None ,
7575 to_ref : str | None = None ,
76+ pre_rebase_upstream : str | None = None ,
77+ pre_rebase_branch : str | None = None ,
7678 remote_name : str | None = None ,
7779 remote_url : str | None = None ,
7880 commit_msg_filename : str | None = None ,
@@ -89,6 +91,8 @@ def _ns(
8991 local_branch = local_branch ,
9092 from_ref = from_ref ,
9193 to_ref = to_ref ,
94+ pre_rebase_upstream = pre_rebase_upstream ,
95+ pre_rebase_branch = pre_rebase_branch ,
9296 remote_name = remote_name ,
9397 remote_url = remote_url ,
9498 commit_msg_filename = commit_msg_filename ,
@@ -185,6 +189,12 @@ def _check_args_length(hook_type: str, args: Sequence[str]) -> None:
185189 f'hook-impl for { hook_type } expected 1, 2, or 3 arguments '
186190 f'but got { len (args )} : { args } ' ,
187191 )
192+ elif hook_type == 'pre-rebase' :
193+ if len (args ) < 1 or len (args ) > 2 :
194+ raise SystemExit (
195+ f'hook-impl for { hook_type } expected 1 or 2 arguments '
196+ f'but got { len (args )} : { args } ' ,
197+ )
188198 elif hook_type in _EXPECTED_ARG_LENGTH_BY_HOOK :
189199 expected = _EXPECTED_ARG_LENGTH_BY_HOOK [hook_type ]
190200 if len (args ) != expected :
@@ -231,6 +241,13 @@ def _run_ns(
231241 return _ns (hook_type , color , is_squash_merge = args [0 ])
232242 elif hook_type == 'post-rewrite' :
233243 return _ns (hook_type , color , rewrite_command = args [0 ])
244+ elif hook_type == 'pre-rebase' and len (args ) == 1 :
245+ return _ns (hook_type , color , pre_rebase_upstream = args [0 ])
246+ elif hook_type == 'pre-rebase' and len (args ) == 2 :
247+ return _ns (
248+ hook_type , color , pre_rebase_upstream = args [0 ],
249+ pre_rebase_branch = args [1 ],
250+ )
234251 else :
235252 raise AssertionError (f'unexpected hook type: { hook_type } ' )
236253
0 commit comments