Skip to content

config: don't switch between trees #4271

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 23, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions dvc/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -314,25 +314,23 @@ def load(self, validate=True):

def _load_config(self, level):
filename = self.files[level]
tree = self.tree if level == "repo" else self.wtree

if tree.exists(filename, use_dvcignore=False):
with tree.open(filename) as fobj:
if self.tree.exists(filename, use_dvcignore=False):
with self.tree.open(filename) as fobj:
conf_obj = configobj.ConfigObj(fobj)
else:
conf_obj = configobj.ConfigObj()
return _parse_remotes(_lower_keys(conf_obj.dict()))

def _save_config(self, level, conf_dict):
filename = self.files[level]
tree = self.tree if level == "repo" else self.wtree

logger.debug(f"Writing '{filename}'.")

tree.makedirs(os.path.dirname(filename))
self.tree.makedirs(os.path.dirname(filename))

config = configobj.ConfigObj(_pack_remotes(conf_dict))
with tree.open(filename, "wb") as fobj:
with self.tree.open(filename, "wb") as fobj:
config.write(fobj)
config.filename = filename

Expand Down
1 change: 1 addition & 0 deletions dvc/utils/build.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
PKG = "deb"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops.