Commit 8c3c070b authored by Dan Villiom Podlaski Christiansen's avatar Dan Villiom Podlaski Christiansen
Browse files

push: hack for head

parent 9dbc51f0f62c
Pipeline #45995 failed with stages
in 4 minutes and 1 second
from __future__ import generator_stop
import collections
import functools
import itertools
import os
import re
......@@ -525,15 +526,4 @@
if new_refs and remote_names:
# make sure that we know the remote head, for possible
# publishing
new_refs_with_head = new_refs.copy()
self.fetch_pack(remote, [b'HEAD']).refs,
except (error.RepoLookupError):
self.ui.debug(b'remote repository has no HEAD\n')
for remote_name in remote_names:
......@@ -539,5 +529,5 @@
for remote_name in remote_names:
self.update_remote_branches(remote_name, new_refs_with_head)
self.update_remote_branches(remote_name, new_refs)
if old_refs == new_refs:
if revs or not old_refs:
......@@ -1378,5 +1368,24 @@
progress = GitProgress(self.ui)
progressfunc = progress.progress
def send_pack(client, path, *args, **kwargs):
# this is a hack that works around the fact that we don't
# get symrefs on push, so we won't know the remote head --
# sadly, there's no direct way of getting remote
# _symrefs_, it seems
def fill_in_head(refs):
remote_refs = client.get_refs(path)
if b'HEAD' in remote_refs:
refs[b'HEAD'] = remote_refs[b'HEAD']
result = client.send_pack(path, *args, **kwargs)
return result
new_refs = self._call_client(
......@@ -1381,6 +1390,6 @@
new_refs = self._call_client(
remote, 'send_pack', changed, genpack, progress=progressfunc
remote, send_pack, changed, genpack, progress=progressfunc
if len(change_totals) > 0:
......@@ -1545,7 +1554,11 @@
def _call_client(self, remote, method, *args, **kwargs):
for ignored in range(self.ui.configint(b'hggit', b'retries')):
clientobj, path = self._get_transport_and_path(remote)
func = getattr(clientobj, method)
func = (
getattr(clientobj, method)
if isinstance(method, str)
else functools.partial(method, clientobj)
return func(path, *args, **kwargs)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment