@@ -323,9 +323,6 @@ protected void retrieve(
323323 try {
324324 GitLabApi gitLabApi = apiBuilder (this .getOwner (), serverName );
325325 getGitlabProject (gitLabApi );
326- setProjectId (gitlabProject .getId ());
327- sshRemote = gitlabProject .getSshUrlToRepo ();
328- httpRemote = gitlabProject .getHttpUrlToRepo ();
329326 GitLabSCMSourceContext ctx = new GitLabSCMSourceContext (criteria , observer );
330327 try (GitLabSCMSourceRequest request = ctx .withTraits (getTraits ()).newRequest (this , listener )) {
331328 request .setGitLabApi (gitLabApi );
@@ -334,7 +331,7 @@ protected void retrieve(
334331 if (request .isFetchBranches ()) {
335332 request .setBranches (gitLabApi .getRepositoryApi ().getBranches (gitlabProject ));
336333 }
337- if (request .isFetchMRs ()) {
334+ if (request .isFetchMRs () && gitlabProject . getMergeRequestsEnabled () ) {
338335 // If not authenticated GitLabApi cannot detect if it is a fork
339336 // If `forkedFromProject` is null it doesn't mean anything
340337 if (gitlabProject .getForkedFromProject () == null ) {
@@ -410,7 +407,7 @@ public SCMSourceCriteria.Probe create(
410407 }
411408 listener .getLogger ().format ("%n%d branches were processed%n" , count );
412409 }
413- if (request .isFetchMRs () && !request .isComplete ()) {
410+ if (request .isFetchMRs () && !request .isComplete () && gitlabProject . getMergeRequestsEnabled () ) {
414411 int count = 0 ;
415412 listener .getLogger ().format ("%nChecking merge requests..%n" );
416413 HashMap <Long , String > forkMrSources = new HashMap <>();
0 commit comments