@@ -120,7 +120,8 @@ def _rev_exists(rev: str) -> bool:
120120
121121
122122def _pre_push (stdin : bytes ) -> Tuple [str , ...]:
123- remote = sys .argv [1 ]
123+ remote_name = sys .argv [1 ]
124+ remote_url = sys .argv [2 ]
124125
125126 opts : Tuple [str , ...] = ()
126127 for line in stdin .decode ().splitlines ():
@@ -133,7 +134,7 @@ def _pre_push(stdin: bytes) -> Tuple[str, ...]:
133134 # ancestors not found in remote
134135 ancestors = subprocess .check_output ((
135136 'git' , 'rev-list' , local_sha , '--topo-order' , '--reverse' ,
136- '--not' , f'--remotes={ remote } ' ,
137+ '--not' , f'--remotes={ remote_name } ' ,
137138 )).decode ().strip ()
138139 if not ancestors :
139140 continue
@@ -150,7 +151,10 @@ def _pre_push(stdin: bytes) -> Tuple[str, ...]:
150151 opts = ('--origin' , local_sha , '--source' , source )
151152
152153 if opts :
153- return opts
154+ remote_opts = (
155+ '--push-remote-name' , remote_name , '--push-remote-url' , remote_url ,
156+ )
157+ return opts + remote_opts
154158 else :
155159 # An attempt to push an empty changeset
156160 raise EarlyExit ()
0 commit comments