check clearcase vobtag before checking vob uuid to save much time on server with several clearcase repositories

Review Request #5166 — Created Dec. 26, 2013 and submitted

Information

RBTools
master

Reviewers

build an ordered list of ClearCase repositories starting with the one matching vobstag
so check clearcase with matching vobstag first then fallback with uuid only to reduce HTTP queries about each rvb repository

found and caught a side issue when there are restricted repositories:
it will try to get info of all clearcase repo until one vobstag uuid matches
it gets a 403 error as soon as it tries getting info of a private and unaccessible for current user :-(

posting reviews against authorized clearcase repo with matching vobstag still works
posting reviews against authorized clearcase repo with no matching vobstag will work whereas there are some unauthorized clearcase repo in the list
posting reviews against unauthorized clearcase repo returns an error

Description From Last Updated

This is pretty confusing. How about we build an ordered list of repositories, putting the ones that match the vobstag …

daviddavid
david
  1. 
      
  2. rbtools/clients/clearcase.py (Diff revision 1)
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
    Show all issues

    This is pretty confusing. How about we build an ordered list of repositories, putting the ones that match the vobstag first? Something like this:

    # Start by scanning all repositories where the vobstag
    # matches.
    repository_scan_order = [
        repo for repo in repositories
        if (repository['tool'] == 'ClearCase' and
            repository['name'] == self.vobstag)
        ]
    
    # Now add all ClearCase repositories
    repository_scan_order.extend([
        repo for repo in repositories
        if (repository['tool'] == 'ClearCase'
            and repository not in repository_scan_order)
        ])
    
    for repository in repository_scan_order:
        info = self._get_repository_info(server, repository)
        if not info or uuid != info['uuid']:
            continue
    
        path = info['repopath']
        logging.debug('Matching repository uuid %s with path %s',
                      uuid, path)
    
        return ClearCaseRepositoryInfo(path, path, uuid)
    

    Note that I haven't tested this.

    1. I've liked your idea of ordered list so I've just tried to optimize loop to prevent 2 times testing each non clearcase repo

      PS: your proposal was working after renaming repo into repository ;-)

  3. 
      
DE
DE
DE
david
  1. Ship It!
  2. 
      
DE
Review request changed

Status: Closed (submitted)

Change Summary:

Pushed to master (70e88eb). Thanks!
Loading...