Move SCM-provided repository name out of RepositoryInfo structure.

Review Request #11504 — Created March 8, 2021 and submitted

Information

RBTools
master

Reviewers

Perforce allows administrators to configure the repository name into the
p4 counters. This was then used in the case where the name was not
already provided from the config or command line options. Unfortunately,
this was stuck into the RepositoryInfo structure, which wasn't the best
place for it. This also meant that even when the repository name was
configured in .reviewboardrc, we'd query the p4 counters looking for it.

This change moves the repository name out of the RepositoryInfo
structure and into a method which is only called if the repository name
is not provided in another way. It also actually uses that name when
querying the repositories inside the get_repository_id method (as
opposed to fetching all repositories and then comparing against the
name).

  • Ran unit tests.
  • Verified that get_repository_id was now only fetching a single
    repository from the API during commands such as rbt status and
    rbt post -u.
Summary ID
Move SCM-provided repository name out of RepositoryInfo structure.
Perforce allows administrators to configure the repository name into the p4 counters. This was then used in the case where the name was not already provided from the config or command line options. Unfortunately, this was stuck into the RepositoryInfo structure, which wasn't the best place for it. This also meant that even when the repository name was configured in .reviewboardrc, we'd query the p4 counters looking for it. This change moves the repository name out of the RepositoryInfo structure and into a method which is only called if the repository name is not provided in another way. It also actually uses that name when querying the repositories inside the `get_repository_id` method (as opposed to fetching all repositories and then comparing against the name). Testing Done: - Ran unit tests. - Verified that `get_repository_id` was now only fetching a single repository from the API during commands such as `rbt status` and `rbt post -u`.
2e875f79db0ab4faf073fba973c3cc78c2b66189
Description From Last Updated

E501 line too long (81 > 79 characters)

reviewbotreviewbot

Let's use :py:meth: to reference get_repository_name.

chipx86chipx86

Can this be one statement?

chipx86chipx86

Can you add Version Added here, before Returns?

chipx86chipx86

This needs to go right after the description text, before Args.

chipx86chipx86
Checks run (1 failed, 1 succeeded)
flake8 failed.
JSHint passed.

flake8

david
chipx86
  1. 
      
  2. rbtools/clients/__init__.py (Diff revision 2)
     
     

    Let's use :py:meth: to reference get_repository_name.

  3. rbtools/utils/repository.py (Diff revision 2)
     
     
     

    Can this be one statement?

  4. 
      
david
chipx86
  1. 
      
  2. rbtools/clients/__init__.py (Diff revision 3)
     
     
     
     
     
     
     
     

    Can you add Version Added here, before Returns?

  3. rbtools/clients/__init__.py (Diff revision 3)
     
     
     
     
     
     
     

    This needs to go right after the description text, before Args.

  4. 
      
david
Review request changed

Status: Closed (submitted)

Change Summary:

Pushed to master (a98f021)
Loading...