prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  git package: warn if specified revision master, main
  Follow up from #3057, #3104
  
  Previously, if a git package was unpinned, dbt tried to install it from `master` (hard coded). In #3104, this was fixed to used `HEAD` (default branch, regardless of name) and continue to warn if unpinned.
  
  We'd like to warn as well if the user specifies the package `revision` as `'master'` or `'main'`, since either almost certainly represents the default branch. Users can disable the warning with `warn-unpinned: false`.
  
  ### Example
  
  ```yml
  packages:
    - git: https://github.com/fishtown-analytics/dbt-codegen 
      revision: master
    - git: https://github.com/tailsdotcom/dbt_artifacts   
      revision: main
    - git: https://gitlab.com/gitlab-data/snowflake_spend
    - package: fishtown-analytics/audit_helper
      version: 0.3.0
  ```
  
  <details>
  <summary> <code>$ dbt deps</code> </summary>
  
  ```
  Running with dbt=0.19.0
  WARNING: The git package "https://github.com/fishtown-analytics/dbt-codegen"
  	is pinned to the "master" branch.
  	This can introduce breaking changes into your project without warning!
  
  See https://docs.getdbt.com/docs/package-management#section-specifying-package-versions
  WARNING: The git package "https://github.com/tailsdotcom/dbt_artifacts"
  	is pinned to the "main" branch.
  	This can introduce breaking changes into your project without warning!
  
  See https://docs.getdbt.com/docs/package-management#section-specifying-package-versions
  WARNING: The git package "https://gitlab.com/gitlab-data/snowflake_spend"
  	is not pinned, using HEAD (default branch).
  	This can introduce breaking changes into your project without warning!
  
  See https://docs.getdbt.com/docs/package-management#section-specifying-package-versions
  WARNING: The git package "https://github.com/fishtown-analytics/dbt-codegen"
  	is pinned to the "master" branch.
  	This can introduce breaking changes into your project without warning!
  
  See https://docs.getdbt.com/docs/package-management#section-specifying-package-versions
  WARNING: The git package "https://github.com/tailsdotcom/dbt_artifacts"
  	is pinned to the "main" branch.
  	This can introduce breaking changes into your project without warning!
  
  See https://docs.getdbt.com/docs/package-management#section-specifying-package-versions
  WARNING: The git package "https://gitlab.com/gitlab-data/snowflake_spend"
  	is not pinned, using HEAD (default branch).
  	This can introduce breaking changes into your project without warning!
  
  See https://docs.getdbt.com/docs/package-management#section-specifying-package-versions
  Installing https://github.com/fishtown-analytics/dbt-codegen@master
    Installed from revision master
  
  Installing https://github.com/tailsdotcom/dbt_artifacts@main
    Installed from revision main
  
  Installing https://gitlab.com/gitlab-data/snowflake_spend@HEAD
    Installed from HEAD (default branch)
  
  Installing fishtown-analytics/audit_helper@0.3.0
    Installed from version 0.3.0
  
  Installing fishtown-analytics/dbt_utils@0.6.4
    Installed from version 0.6.4
  ```
  
  </details>
  
  ```yml
  packages:
    - git: https://github.com/fishtown-analytics/dbt-codegen 
      revision: master
      warn-unpinned: false
    - git: https://github.com/tailsdotcom/dbt_artifacts   
      revision: main
      warn-unpinned: false
    - git: https://gitlab.com/gitlab-data/snowflake_spend
      warn-unpinned: false
    - package: fishtown-analytics/audit_helper
      version: 0.3.0
  ```
  
  <details>
  <summary> <code>$ dbt deps</code> </summary>
  
  ```
  Running with dbt=0.19.0
  Installing https://github.com/fishtown-analytics/dbt-codegen@master
    Installed from revision master
  
  Installing https://github.com/tailsdotcom/dbt_artifacts@main
    Installed from revision main
  
  Installing https://gitlab.com/gitlab-data/snowflake_spend@HEAD
    Installed from HEAD (default branch)
  
  Installing fishtown-analytics/audit_helper@0.3.0
    Installed from version 0.3.0
  
  Installing fishtown-analytics/dbt_utils@0.6.4
    Installed from version 0.6.4
  ```
  </details>
  
  ### Checklist
   - [x] I have signed the [CLA](https://docs.getdbt.com/docs/contributor-license-agreements)
   - [x] I have run this code in development and it appears to resolve the stated issue
   - ~This PR includes tests, or tests are not required/relevant for this PR~
   - [x] I have updated the `CHANGELOG.md` and added information about my change to the "dbt next" section.
  
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `core/dbt/clients/registry.py`
  Content:
  ```
  1 from functools import wraps
  2 import requests
  3 from dbt.exceptions import RegistryException
  4 from dbt.utils import memoized
  5 from dbt.logger import GLOBAL_LOGGER as logger
  6 import os
  7 import time
  8 
  9 if os.getenv('DBT_PACKAGE_HUB_URL'):
  10     DEFAULT_REGISTRY_BASE_URL = os.getenv('DBT_PACKAGE_HUB_URL')
  11 else:
  12     DEFAULT_REGISTRY_BASE_URL = 'https://hub.getdbt.com/'
  13 
  14 
  15 def _get_url(url, registry_base_url=None):
  16     if registry_base_url is None:
  17         registry_base_url = DEFAULT_REGISTRY_BASE_URL
  18 
  19     return '{}{}'.format(registry_base_url, url)
  20 
  21 
  22 def _wrap_exceptions(fn):
  23     @wraps(fn)
  24     def wrapper(*args, **kwargs):
  25         max_attempts = 5
  26         attempt = 0
  27         while True:
  28             attempt += 1
  29             try:
  30                 return fn(*args, **kwargs)
  31             except requests.exceptions.ConnectionError as exc:
  32                 if attempt < max_attempts:
  33                     time.sleep(1)
  34                     continue
  35 
  36                 raise RegistryException(
  37                     'Unable to connect to registry hub'
  38                 ) from exc
  39     return wrapper
  40 
  41 
  42 @_wrap_exceptions
  43 def _get(path, registry_base_url=None):
  44     url = _get_url(path, registry_base_url)
  45     logger.debug('Making package registry request: GET {}'.format(url))
  46     resp = requests.get(url)
  47     logger.debug('Response from registry: GET {} {}'.format(url,
  48                                                             resp.status_code))
  49     resp.raise_for_status()
  50     return resp.json()
  51 
  52 
  53 def index(registry_base_url=None):
  54     return _get('api/v1/index.json', registry_base_url)
  55 
  56 
  57 index_cached = memoized(index)
  58 
  59 
  60 def packages(registry_base_url=None):
  61     return _get('api/v1/packages.json', registry_base_url)
  62 
  63 
  64 def package(name, registry_base_url=None):
  65     return _get('api/v1/{}.json'.format(name), registry_base_url)
  66 
  67 
  68 def package_version(name, version, registry_base_url=None):
  69     return _get('api/v1/{}/{}.json'.format(name, version), registry_base_url)
  70 
  71 
  72 def get_available_versions(name):
  73     response = package(name)
  74     return list(response['versions'])
  75
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/core/dbt/clients/registry.py b/core/dbt/clients/registry.py
  --- a/core/dbt/clients/registry.py
  +++ b/core/dbt/clients/registry.py
  @@ -28,11 +28,10 @@
               attempt += 1
               try:
                   return fn(*args, **kwargs)
  -            except requests.exceptions.ConnectionError as exc:
  +            except (requests.exceptions.ConnectionError, requests.exceptions.Timeout) as exc:
                   if attempt < max_attempts:
                       time.sleep(1)
                       continue
  -
                   raise RegistryException(
                       'Unable to connect to registry hub'
                   ) from exc
  @@ -43,7 +42,7 @@
   def _get(path, registry_base_url=None):
       url = _get_url(path, registry_base_url)
       logger.debug('Making package registry request: GET {}'.format(url))
  -    resp = requests.get(url)
  +    resp = requests.get(url, timeout=30)
       logger.debug('Response from registry: GET {} {}'.format(url,
                                                               resp.status_code))
       resp.raise_for_status()
  
verification_info: {"golden_diff": "diff --git a/core/dbt/clients/registry.py b/core/dbt/clients/registry.py\n--- a/core/dbt/clients/registry.py\n+++ b/core/dbt/clients/registry.py\n@@ -28,11 +28,10 @@\n             attempt += 1\n             try:\n                 return fn(*args, **kwargs)\n-            except requests.exceptions.ConnectionError as exc:\n+            except (requests.exceptions.ConnectionError, requests.exceptions.Timeout) as exc:\n                 if attempt < max_attempts:\n                     time.sleep(1)\n                     continue\n-\n                 raise RegistryException(\n                     'Unable to connect to registry hub'\n                 ) from exc\n@@ -43,7 +42,7 @@\n def _get(path, registry_base_url=None):\n     url = _get_url(path, registry_base_url)\n     logger.debug('Making package registry request: GET {}'.format(url))\n-    resp = requests.get(url)\n+    resp = requests.get(url, timeout=30)\n     logger.debug('Response from registry: GET {} {}'.format(url,\n                                                             resp.status_code))\n     resp.raise_for_status()\n", "issue": "git package: warn if specified revision master, main\nFollow up from #3057, #3104\r\n\r\nPreviously, if a git package was unpinned, dbt tried to install it from `master` (hard coded). In #3104, this was fixed to used `HEAD` (default branch, regardless of name) and continue to warn if unpinned.\r\n\r\nWe'd like to warn as well if the user specifies the package `revision` as `'master'` or `'main'`, since either almost certainly represents the default branch. Users can disable the warning with `warn-unpinned: false`.\r\n\r\n### Example\r\n\r\n```yml\r\npackages:\r\n  - git: https://github.com/fishtown-analytics/dbt-codegen \r\n    revision: master\r\n  - git: https://github.com/tailsdotcom/dbt_artifacts   \r\n    revision: main\r\n  - git: https://gitlab.com/gitlab-data/snowflake_spend\r\n  - package: fishtown-analytics/audit_helper\r\n    version: 0.3.0\r\n```\r\n\r\n<details>\r\n<summary> <code>$ dbt deps</code> </summary>\r\n\r\n```\r\nRunning with dbt=0.19.0\r\nWARNING: The git package \"https://github.com/fishtown-analytics/dbt-codegen\"\r\n\tis pinned to the \"master\" branch.\r\n\tThis can introduce breaking changes into your project without warning!\r\n\r\nSee https://docs.getdbt.com/docs/package-management#section-specifying-package-versions\r\nWARNING: The git package \"https://github.com/tailsdotcom/dbt_artifacts\"\r\n\tis pinned to the \"main\" branch.\r\n\tThis can introduce breaking changes into your project without warning!\r\n\r\nSee https://docs.getdbt.com/docs/package-management#section-specifying-package-versions\r\nWARNING: The git package \"https://gitlab.com/gitlab-data/snowflake_spend\"\r\n\tis not pinned, using HEAD (default branch).\r\n\tThis can introduce breaking changes into your project without warning!\r\n\r\nSee https://docs.getdbt.com/docs/package-management#section-specifying-package-versions\r\nWARNING: The git package \"https://github.com/fishtown-analytics/dbt-codegen\"\r\n\tis pinned to the \"master\" branch.\r\n\tThis can introduce breaking changes into your project without warning!\r\n\r\nSee https://docs.getdbt.com/docs/package-management#section-specifying-package-versions\r\nWARNING: The git package \"https://github.com/tailsdotcom/dbt_artifacts\"\r\n\tis pinned to the \"main\" branch.\r\n\tThis can introduce breaking changes into your project without warning!\r\n\r\nSee https://docs.getdbt.com/docs/package-management#section-specifying-package-versions\r\nWARNING: The git package \"https://gitlab.com/gitlab-data/snowflake_spend\"\r\n\tis not pinned, using HEAD (default branch).\r\n\tThis can introduce breaking changes into your project without warning!\r\n\r\nSee https://docs.getdbt.com/docs/package-management#section-specifying-package-versions\r\nInstalling https://github.com/fishtown-analytics/dbt-codegen@master\r\n  Installed from revision master\r\n\r\nInstalling https://github.com/tailsdotcom/dbt_artifacts@main\r\n  Installed from revision main\r\n\r\nInstalling https://gitlab.com/gitlab-data/snowflake_spend@HEAD\r\n  Installed from HEAD (default branch)\r\n\r\nInstalling fishtown-analytics/audit_helper@0.3.0\r\n  Installed from version 0.3.0\r\n\r\nInstalling fishtown-analytics/dbt_utils@0.6.4\r\n  Installed from version 0.6.4\r\n```\r\n\r\n</details>\r\n\r\n```yml\r\npackages:\r\n  - git: https://github.com/fishtown-analytics/dbt-codegen \r\n    revision: master\r\n    warn-unpinned: false\r\n  - git: https://github.com/tailsdotcom/dbt_artifacts   \r\n    revision: main\r\n    warn-unpinned: false\r\n  - git: https://gitlab.com/gitlab-data/snowflake_spend\r\n    warn-unpinned: false\r\n  - package: fishtown-analytics/audit_helper\r\n    version: 0.3.0\r\n```\r\n\r\n<details>\r\n<summary> <code>$ dbt deps</code> </summary>\r\n\r\n```\r\nRunning with dbt=0.19.0\r\nInstalling https://github.com/fishtown-analytics/dbt-codegen@master\r\n  Installed from revision master\r\n\r\nInstalling https://github.com/tailsdotcom/dbt_artifacts@main\r\n  Installed from revision main\r\n\r\nInstalling https://gitlab.com/gitlab-data/snowflake_spend@HEAD\r\n  Installed from HEAD (default branch)\r\n\r\nInstalling fishtown-analytics/audit_helper@0.3.0\r\n  Installed from version 0.3.0\r\n\r\nInstalling fishtown-analytics/dbt_utils@0.6.4\r\n  Installed from version 0.6.4\r\n```\r\n</details>\r\n\r\n### Checklist\r\n - [x] I have signed the [CLA](https://docs.getdbt.com/docs/contributor-license-agreements)\r\n - [x] I have run this code in development and it appears to resolve the stated issue\r\n - ~This PR includes tests, or tests are not required/relevant for this PR~\r\n - [x] I have updated the `CHANGELOG.md` and added information about my change to the \"dbt next\" section.\r\n\n", "before_files": [{"content": "from functools import wraps\nimport requests\nfrom dbt.exceptions import RegistryException\nfrom dbt.utils import memoized\nfrom dbt.logger import GLOBAL_LOGGER as logger\nimport os\nimport time\n\nif os.getenv('DBT_PACKAGE_HUB_URL'):\n    DEFAULT_REGISTRY_BASE_URL = os.getenv('DBT_PACKAGE_HUB_URL')\nelse:\n    DEFAULT_REGISTRY_BASE_URL = 'https://hub.getdbt.com/'\n\n\ndef _get_url(url, registry_base_url=None):\n    if registry_base_url is None:\n        registry_base_url = DEFAULT_REGISTRY_BASE_URL\n\n    return '{}{}'.format(registry_base_url, url)\n\n\ndef _wrap_exceptions(fn):\n    @wraps(fn)\n    def wrapper(*args, **kwargs):\n        max_attempts = 5\n        attempt = 0\n        while True:\n            attempt += 1\n            try:\n                return fn(*args, **kwargs)\n            except requests.exceptions.ConnectionError as exc:\n                if attempt < max_attempts:\n                    time.sleep(1)\n                    continue\n\n                raise RegistryException(\n                    'Unable to connect to registry hub'\n                ) from exc\n    return wrapper\n\n\n@_wrap_exceptions\ndef _get(path, registry_base_url=None):\n    url = _get_url(path, registry_base_url)\n    logger.debug('Making package registry request: GET {}'.format(url))\n    resp = requests.get(url)\n    logger.debug('Response from registry: GET {} {}'.format(url,\n                                                            resp.status_code))\n    resp.raise_for_status()\n    return resp.json()\n\n\ndef index(registry_base_url=None):\n    return _get('api/v1/index.json', registry_base_url)\n\n\nindex_cached = memoized(index)\n\n\ndef packages(registry_base_url=None):\n    return _get('api/v1/packages.json', registry_base_url)\n\n\ndef package(name, registry_base_url=None):\n    return _get('api/v1/{}.json'.format(name), registry_base_url)\n\n\ndef package_version(name, version, registry_base_url=None):\n    return _get('api/v1/{}/{}.json'.format(name, version), registry_base_url)\n\n\ndef get_available_versions(name):\n    response = package(name)\n    return list(response['versions'])\n", "path": "core/dbt/clients/registry.py"}], "after_files": [{"content": "from functools import wraps\nimport requests\nfrom dbt.exceptions import RegistryException\nfrom dbt.utils import memoized\nfrom dbt.logger import GLOBAL_LOGGER as logger\nimport os\nimport time\n\nif os.getenv('DBT_PACKAGE_HUB_URL'):\n    DEFAULT_REGISTRY_BASE_URL = os.getenv('DBT_PACKAGE_HUB_URL')\nelse:\n    DEFAULT_REGISTRY_BASE_URL = 'https://hub.getdbt.com/'\n\n\ndef _get_url(url, registry_base_url=None):\n    if registry_base_url is None:\n        registry_base_url = DEFAULT_REGISTRY_BASE_URL\n\n    return '{}{}'.format(registry_base_url, url)\n\n\ndef _wrap_exceptions(fn):\n    @wraps(fn)\n    def wrapper(*args, **kwargs):\n        max_attempts = 5\n        attempt = 0\n        while True:\n            attempt += 1\n            try:\n                return fn(*args, **kwargs)\n            except (requests.exceptions.ConnectionError, requests.exceptions.Timeout) as exc:\n                if attempt < max_attempts:\n                    time.sleep(1)\n                    continue\n                raise RegistryException(\n                    'Unable to connect to registry hub'\n                ) from exc\n    return wrapper\n\n\n@_wrap_exceptions\ndef _get(path, registry_base_url=None):\n    url = _get_url(path, registry_base_url)\n    logger.debug('Making package registry request: GET {}'.format(url))\n    resp = requests.get(url, timeout=30)\n    logger.debug('Response from registry: GET {} {}'.format(url,\n                                                            resp.status_code))\n    resp.raise_for_status()\n    return resp.json()\n\n\ndef index(registry_base_url=None):\n    return _get('api/v1/index.json', registry_base_url)\n\n\nindex_cached = memoized(index)\n\n\ndef packages(registry_base_url=None):\n    return _get('api/v1/packages.json', registry_base_url)\n\n\ndef package(name, registry_base_url=None):\n    return _get('api/v1/{}.json'.format(name), registry_base_url)\n\n\ndef package_version(name, version, registry_base_url=None):\n    return _get('api/v1/{}/{}.json'.format(name, version), registry_base_url)\n\n\ndef get_available_versions(name):\n    response = package(name)\n    return list(response['versions'])\n", "path": "core/dbt/clients/registry.py"}]}