From 14b816b40f44ca19d51d9fe478fdcae8cc53d73a Mon Sep 17 00:00:00 2001 From: Ben Brown Date: Fri, 17 Jun 2016 19:08:37 +0100 Subject: Add docstring for suitable_path() Change-Id: I3a95880618218da00991f8ac58dee54d06a0da41 --- lorrycontroller/gitlab.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'lorrycontroller') diff --git a/lorrycontroller/gitlab.py b/lorrycontroller/gitlab.py index b22bb30..55b8e4f 100644 --- a/lorrycontroller/gitlab.py +++ b/lorrycontroller/gitlab.py @@ -94,6 +94,18 @@ class Gitlab(object): return match.groups()[0] def suitable_path(self, project): + '''Return a path for a downstream Lorry Controller instance to consume. + + Should the path that was lorried have contained more than one level of + namespacing (more than one '/' within the repository path), then for + GitLab to handle this, we replace any '/'s (remaining in the project + name after extracting the group name) with underscores (_). To preserve + the original path, we set the 'original_path' within the project + description. + This method will attempt to return 'original_path' if it was set, + otherwise it will return the 'path_with_namespace', being of the format + 'group_name/project_name', rather than 'group_name/project/name'. + ''' return (self.try_get_original_path(project.description) or project.path_with_namespace) -- cgit v1.2.1