Skip to content

Commit 13a6442

Browse files
committed
🔥 Got rid of extracts_ref
1 parent 6c0ffab commit 13a6442

File tree

1 file changed

+2
-12
lines changed

1 file changed

+2
-12
lines changed

git_repo/services/service.py

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -251,23 +251,13 @@ def _convert_user_into_remote(self, username, exclude=['all']):
251251
# builds a ref with an username and a branch
252252
# this method parses the repository's remotes to find the url matching username
253253
# and containing the given branch and returns the corresponding ref
254-
255254
remotes = {remote.name: list(remote.urls) for remote in self.repository.remotes}
256-
for name in ('upstream', self.name) + tuple(remotes.keys()):
255+
for name in (self.name, 'upstream') + tuple(remotes.keys()):
257256
if name in remotes and name not in exclude:
258257
for url in remotes[name]:
259-
if self.fqdn in url and username == url.split(':')[1].split('/')[0]:
258+
if self.fqdn in url and username == url.split('/')[-2].split(':')[-1]:
260259
yield name
261260

262-
def _extracts_ref(self, user, from_branch):
263-
for name in self._convert_user_into_remote(user):
264-
ref_name = '{}/{}'.format(name, from_branch)
265-
for ref in self.repository.refs:
266-
if ref.name.endswith(ref_name):
267-
return ref
268-
269-
raise ArgumentError('Could not find a remote for user {} containing branch {}'.format(username))
270-
271261
def format_path(self, repository, namespace=None, rw=False):
272262
'''format the repository's URL
273263

0 commit comments

Comments
 (0)