Uploaded image for project: 'Nuxeo Studio'
  1. Nuxeo Studio
  2. NXS-4038

Fix fallback on default branch in Studio

    XMLWordPrintable

    Details

      Description

      When the current branch of a user is not found (i.e it has been removed directly in gitlab), an alert message pops up saying "Error: The branch "XXX" was not found for the project "project1-spartasystems". Falling back to default branch." But when clicking on OK, nothing happens and the message pops up again and again for ever...

      Another problem is found during the implementation: the alert message pop up twice before falling back to the master branch. This should be fixed, too.

      Technical Detail

      When GWT loads a user project, it loads it through method StudioServiceImpl#getProject(String):

      StudioServiceImpl.java (excerpt)
          @Override
          public ProjectModel getProject(String projectId) throws ProjectNotFoundException, BranchNotFoundException,
                  IOException, ValidationErrorBundle, TargetPlatformNotFoundException {
              ...
      
              try {
                  userWs = userPrefsService.getUserWorkspace(projectId, principal);
              } catch (BranchNotFoundException e) {
                  // it seems the user prefs point at a non existing branch. We fall back to the default one:
                  UserPrefs userPrefs = userPrefsService.getUserPrefs(projectId, principal.getName());
                  userPrefs.setActiveBranch(BranchService.DEFAULT_BRANCH_NAME);
                  userPrefsService.updateUserPrefs(projectId, userPrefs);
                  throw e;
              }
              ...
          }
      

      During the workspace loading phrase, if a branch is not found, UserPrefsService should raise a BranchNotFoundException so that Studio service can fallback to the default branch. However, this exception is not always raised:

      1. If user has write access and his active working branch is missing, then we create it again.
      2. If user has write access and his active branch is missing, then there's no check.
      3. If user does not have write access, then we checkout the active branch.

      This ticket aims to fix the situation 2, where the active branch is missing. In other words, when the base branch of the current WIP branch is missing, we raise a BranchNotFoundException.

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 2 days, 1 hour
                  2d 1h