diff options
Diffstat (limited to 'lorrycontroller/gerrit.py')
-rw-r--r-- | lorrycontroller/gerrit.py | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/lorrycontroller/gerrit.py b/lorrycontroller/gerrit.py index 6fde905..dd82ff8 100644 --- a/lorrycontroller/gerrit.py +++ b/lorrycontroller/gerrit.py @@ -66,12 +66,22 @@ class GerritDownstream(hosts.DownstreamHost): The 'lorry' user must have createProject capability in the Gerrit. ''' - # TODO: set metadata if self._has_project(name): logging.info('Project %s exists in local Gerrit already.', name) - return - - self._ssh_command(['gerrit', 'create-project', name]) - logging.info('Created %s project in local Gerrit.', name) + else: + self._ssh_command(['gerrit', 'create-project', name]) + logging.info('Created %s project in local Gerrit.', name) + + # We can only set this metadata if we're the owner of the + # repository. For now, ignore failures. + try: + if 'head' in metadata: + self._ssh_command(['gerrit', 'set-head', name, + '--new-head', metadata['head']]) + if 'description' in metadata: + self._ssh_command(['gerrit', 'set-project', name, + '-d', metadata['description']]) + except cliapp.AppException: + pass |