@@ -366,7 +366,10 @@ def find_home_config_files(
366366
367367 Examples
368368 --------
369- >>> find_home_config_files()
369+ >>> with tempfile.TemporaryDirectory() as home:
370+ ... with getfixture("monkeypatch").context() as patch:
371+ ... patch.setenv("HOME", home)
372+ ... find_home_config_files()
370373 []
371374 """
372375 if filetype is None :
@@ -1021,19 +1024,19 @@ def build_repo_entry(
10211024 """Build a raw per-repository config entry for ``add``/``discover``.
10221025
10231026 Centralizes the entry shape written by both subcommands so the recorded
1024- keys stay consistent. Sync-tuning keys are nested under ``options: ``;
1027+ keys stay consistent. Targets use ``working_copy`` and clone settings use ``git ``;
10251028 ``depth`` wins over ``shallow`` when both are supplied.
10261029
10271030 Parameters
10281031 ----------
10291032 url : str
10301033 VCS URL in vcspull format, e.g. ``git+https://github.com/u/r.git``.
10311034 rev : str | None
1032- Commit, tag, or branch to pin via ``options .rev``. Omitted when falsy.
1035+ Commit, tag, or branch to pin via ``working_copy .rev``. Omitted when falsy.
10331036 shallow : bool
1034- If ``True``, record ``options.shallow: true `` (clone ``--depth 1``).
1037+ If ``True``, record ``git.depth: 1 `` (clone ``--depth 1``).
10351038 depth : int | None
1036- If set, record ``options .depth: N`` (clone ``--depth N``).
1039+ If set, record ``git .depth: N`` (clone ``--depth N``).
10371040
10381041 Returns
10391042 -------
@@ -1046,35 +1049,33 @@ def build_repo_entry(
10461049 {'repo': 'git+https://github.com/u/r.git'}
10471050
10481051 >>> build_repo_entry("git+https://github.com/u/r.git", rev="v1.0.0")
1049- {'repo': 'git+https://github.com/u/r.git', 'options ': {'rev': 'v1.0.0'}}
1052+ {'repo': 'git+https://github.com/u/r.git', 'working_copy ': {'rev': 'v1.0.0'}}
10501053
10511054 >>> build_repo_entry("git+https://github.com/u/r.git", shallow=True)
1052- {'repo': 'git+https://github.com/u/r.git', 'options ': {'shallow ': True }}
1055+ {'repo': 'git+https://github.com/u/r.git', 'git ': {'depth ': 1 }}
10531056
10541057 >>> build_repo_entry("git+https://github.com/u/r.git", depth=50)
1055- {'repo': 'git+https://github.com/u/r.git', 'options ': {'depth': 50}}
1058+ {'repo': 'git+https://github.com/u/r.git', 'git ': {'depth': 50}}
10561059
10571060 ``depth`` wins over ``shallow``:
10581061
10591062 >>> build_repo_entry("git+https://github.com/u/r.git", shallow=True, depth=50)
1060- {'repo': 'git+https://github.com/u/r.git', 'options ': {'depth': 50}}
1063+ {'repo': 'git+https://github.com/u/r.git', 'git ': {'depth': 50}}
10611064 """
10621065 entry : dict [str , t .Any ] = {"repo" : url }
1063- options : dict [str , t .Any ] = {}
10641066 if rev :
1065- options [ "rev " ] = rev
1066- if depth :
1067- options [ "depth " ] = depth
1067+ entry [ "working_copy " ] = { " rev" : rev }
1068+ if depth is not None :
1069+ entry [ "git " ] = { " depth" : depth }
10681070 elif shallow :
1069- options ["shallow" ] = True
1070- if options :
1071- entry ["options" ] = options
1071+ entry ["git" ] = {"depth" : 1 }
1072+ validate_repo_entry (entry , location = "repository" )
1073+ if "working_copy" in entry :
1074+ validate_working_copy (entry ["working_copy" ])
10721075 return entry
10731076
10741077
1075- #: Per-repository sync-tuning keys whose canonical home is the ``options:``
1076- #: block. They were accepted at the entry root in v1.61.0; that form is now
1077- #: deprecated and migrated by :func:`migrate_repo_entry`.
1078+ #: Legacy flat tuning fields migrated into ``working_copy`` or ``git``.
10781079LEGACY_REPO_OPTION_KEYS = ("rev" , "shallow" , "depth" )
10791080
10801081
0 commit comments