comparison hggit/git_handler.py @ 1116:bd1a01f98154

cleanup: wrap to 80 chars
author Sean Farley <sean@farley.io>
date Mon, 27 Nov 2017 19:05:08 -0500
parents 8ed6c0cae9b8
children 666ab5997802
comparison
equal deleted inserted replaced
1115:8ed6c0cae9b8 1116:bd1a01f98154
1209 1209
1210 def fetch_pack(self, remote_name, heads=None): 1210 def fetch_pack(self, remote_name, heads=None):
1211 localclient, path = self.get_transport_and_path(remote_name) 1211 localclient, path = self.get_transport_and_path(remote_name)
1212 1212
1213 # The dulwich default walk only checks refs/heads/. We also want to 1213 # The dulwich default walk only checks refs/heads/. We also want to
1214 # consider remotes when doing discovery, so we build our own list. We 1214 # consider remotes when doing discovery, so we build our own list. We
1215 # can't just do 'refs/' here because the tag class doesn't have a 1215 # can't just do 'refs/' here because the tag class doesn't have a
1216 # parents function for walking, and older versions of dulwich don't like 1216 # parents function for walking, and older versions of dulwich don't
1217 # that. 1217 # like that.
1218 haveheads = self.git.refs.as_dict('refs/remotes/').values() 1218 haveheads = self.git.refs.as_dict('refs/remotes/').values()
1219 haveheads.extend(self.git.refs.as_dict('refs/heads/').values()) 1219 haveheads.extend(self.git.refs.as_dict('refs/heads/').values())
1220 graphwalker = self.git.get_graph_walker(heads=haveheads) 1220 graphwalker = self.git.get_graph_walker(heads=haveheads)
1221 1221
1222 def determine_wants(refs): 1222 def determine_wants(refs):
1251 symrefs = {} 1251 symrefs = {}
1252 # we want to raise a KeyError if HEAD is not a key 1252 # we want to raise a KeyError if HEAD is not a key
1253 if head: 1253 if head:
1254 symrefs["HEAD"] = head 1254 symrefs["HEAD"] = head
1255 # use FetchPackResult as upstream now does 1255 # use FetchPackResult as upstream now does
1256 ret = compat.FetchPackResult(ret, 1256 agent = client.default_user_agent_string()
1257 symrefs, 1257 ret = compat.FetchPackResult(ret, symrefs, agent)
1258 client.default_user_agent_string())
1259 return ret 1258 return ret
1260 except (HangupException, GitProtocolError), e: 1259 except (HangupException, GitProtocolError), e:
1261 raise hgutil.Abort(_("git remote error: ") + str(e)) 1260 raise hgutil.Abort(_("git remote error: ") + str(e))
1262 1261
1263 # REFERENCES HANDLING 1262 # REFERENCES HANDLING
1698 >>> mockrepo = namedtuple('localrepo', ['vfs', 'sharedpath', 'path']) 1697 >>> mockrepo = namedtuple('localrepo', ['vfs', 'sharedpath', 'path'])
1699 >>> mockrepo.vfs = '' 1698 >>> mockrepo.vfs = ''
1700 >>> mockrepo.sharedpath = '' 1699 >>> mockrepo.sharedpath = ''
1701 >>> mockrepo.path = '' 1700 >>> mockrepo.path = ''
1702 >>> g = GitHandler(mockrepo, ui()) 1701 >>> g = GitHandler(mockrepo, ui())
1703 >>> client, url = g.get_transport_and_path('http://fqdn.com/test.git') 1702 >>> tp = g.get_transport_and_path
1703 >>> client, url = tp('http://fqdn.com/test.git')
1704 >>> print isinstance(client, HttpGitClient) 1704 >>> print isinstance(client, HttpGitClient)
1705 True 1705 True
1706 >>> print url 1706 >>> print url
1707 http://fqdn.com/test.git 1707 http://fqdn.com/test.git
1708 >>> client, url = g.get_transport_and_path('git@fqdn.com:user/repo.git') 1708 >>> client, url = tp('git@fqdn.com:user/repo.git')
1709 >>> print isinstance(client, SSHGitClient) 1709 >>> print isinstance(client, SSHGitClient)
1710 True 1710 True
1711 >>> print url 1711 >>> print url
1712 user/repo.git 1712 user/repo.git
1713 >>> print client.host 1713 >>> print client.host