Skip to content

Commit d6a1ba5

Browse files
committed
🚧 Implements upstream resolution for gogs
1 parent 82de047 commit d6a1ba5

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

git_repo/services/ext/gogs.py

+10-4
Original file line numberDiff line numberDiff line change
@@ -233,10 +233,16 @@ def get_parent_project_url(self, user, repo, rw=True): #pragma: no cover
233233
project = self.get_repository(user, repo)
234234
if not project.fork:
235235
return None
236-
# TODO fix GoGs API to provide that mising information
237-
self.log.warning('This project has an upstream, but the API does not give information on which.')
238-
return None
239-
236+
if not hasattr(project, 'parent'):
237+
# Not yet in gogs_client
238+
# cf https://github.com/unfoldingWord-dev/python-gogs-client/pull/12
239+
log.warning('This project has an upstream, but the API does not give information on which.')
240+
return None
241+
elif project.parent:
242+
namespace, project = parent.full_name.split('/')
243+
return self.format_path(project, namespace, rw=rw)
244+
else:
245+
return None
240246

241247
@staticmethod
242248
def get_project_default_branch(project):

0 commit comments

Comments
 (0)