Skip to content

Repository.open_with_config #1364

@TomNicholas

Description

@TomNicholas

Problem

Sometimes you want to know about the repo config before you open the repo. For this there is already the classmethod Repository.fetch_config(). But once you have this config, Repository.open() will re-download the config that you already have. This means an unnecessary extra roundtrip to remote storage.

Proposed Solution

A new piece of API that allows opening a repo without re-downloading the config. e.g. Repository.open_with_config.

Additional context

I'm not totally sure what to name this new method - Repository.open() already has a config kwarg, but its meaning is subtly different:

  • config in Repo.open means "fetch the stored repo config, merge it with the config passed by the user, then use that merged config to open the repo",
  • config in Repo.open_with_config means "don't fetch the stored repo config at all (so ignoring it entirely), and use the config passed by the user to open the repo".

So maybe we call the new method .open_using_config or .open_with_config_override?

In fact maybe a new method isn't required at all, we could just add a new kwarg override_config: bool kwarg to Repository.open...

I also have to say that I don't understand how Repository.reopen() is different.

Metadata

Metadata

Assignees

Type

No type

Projects

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions