checkout using gitlab pull pattern
@@ -12,7 +12,13 @@ from git.exc import BadName, InvalidGitRepositoryError
from readthedocs.builds.constants import EXTERNAL
from readthedocs.config import ALL
-from readthedocs.projects.constants import GITHUB_PR_PULL_PATTERN
+from readthedocs.projects.constants import (
+ GITHUB_BRAND,
+ GITHUB_PR_PULL_PATTERN,
+ GITLAB_BRAND,
+ GITLAB_MR_PULL_PATTERN,
+
+)
from readthedocs.projects.exceptions import RepositoryError
from readthedocs.projects.validators import validate_submodule_url
from readthedocs.vcs_support.base import BaseVCS, VCSVersion
@@ -149,15 +155,18 @@ class Backend(BaseVCS):
if self.use_shallow_clone():
cmd.extend(['--depth', str(self.repo_depth)])
- if (
- self.verbose_name and
- self.version_type == EXTERNAL and
- 'github.com' in self.repo_url
- ):
+ if self.verbose_name and self.version_type == EXTERNAL:
+
+ if self.project.git_provider_name == GITHUB_BRAND:
cmd.append(
GITHUB_PR_PULL_PATTERN.format(id=self.verbose_name)
)
+ if self.project.git_provider_name == GITLAB_BRAND:
+ cmd.append(
+ GITLAB_MR_PULL_PATTERN.format(id=self.verbose_name)
+ )
+
code, stdout, stderr = self.run(*cmd)
if code != 0:
raise RepositoryError
