/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to breezy/plugins/gitlab/hoster.py

Add dedicated exception for GitLab project creation timeout.

Merged from https://code.launchpad.net/~jelmer/brz/gitlab-timeout/+merge/392677

Show diffs side-by-side

added added

removed removed

Lines of Context:
129
129
    """Raised when a merge requests already exists."""
130
130
 
131
131
 
 
132
class ProjectCreationTimeout(errors.BzrError):
 
133
 
 
134
    _fmt = ("Timeout (%(timeout)ds) while waiting for project "
 
135
            "%(project)s to be created.")
 
136
 
 
137
    def __init__(self, project, timeout):
 
138
        self.project = project
 
139
        self.timeout = timeout
 
140
 
 
141
 
132
142
def default_config_path():
133
143
    return os.path.join(bedding.config_dir(), 'gitlab.conf')
134
144
 
419
429
        while project['import_status'] not in ('finished', 'none'):
420
430
            mutter('import status is %s', project['import_status'])
421
431
            if time.time() > deadline:
422
 
                raise Exception('timeout waiting for project to become available')
 
432
                raise ProjectCreationTimeout(
 
433
                    project['path_with_namespace'], timeout)
423
434
            time.sleep(interval)
424
435
            project = self._get_project(project['path_with_namespace'])
425
436
        return project