Skip to content

ConfigManager supports bare repos#6332

Merged
mih merged 2 commits intodatalad:masterfrom
mih:bareconfig
Feb 3, 2022
Merged

ConfigManager supports bare repos#6332
mih merged 2 commits intodatalad:masterfrom
mih:bareconfig

Conversation

@mih
Copy link
Member

@mih mih commented Dec 17, 2021

Changelog

🐛 Bug Fixes

💫 Enhancements and new features

  • ConfigManager now supports reading committed dataset configuration in bare repositories. Analog to reading .datalad/config from a worktree, blob:HEAD:.datalad/config is read (e.g., the config committed in the default branch). The support includes reload() change detection using the gitsha of this file. The behavior for non-bare repositories is unchanged. Fixes ConfigManager cannot handle bare repo's (dataset/branch config) #6264

@mih mih added bare-mode Issue regarding operation on bare mode repositories cmd-config(urgation) labels Dec 17, 2021
@codecov
Copy link

codecov bot commented Dec 17, 2021

Codecov Report

Merging #6332 (d2288d9) into master (c0b2d05) will decrease coverage by 0.06%.
The diff coverage is 98.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #6332      +/-   ##
==========================================
- Coverage   89.98%   89.92%   -0.07%     
==========================================
  Files         344      345       +1     
  Lines       43274    43312      +38     
==========================================
+ Hits        38942    38948       +6     
- Misses       4332     4364      +32     
Impacted Files Coverage Δ
datalad/config.py 97.55% <96.77%> (+0.83%) ⬆️
datalad/tests/test_config.py 99.71% <100.00%> (+0.01%) ⬆️
datalad/runner/coreprotocols.py 94.73% <0.00%> (-5.27%) ⬇️
datalad/support/keyring_.py 90.32% <0.00%> (-4.84%) ⬇️
datalad/runner/protocol.py 95.58% <0.00%> (-4.42%) ⬇️
datalad/support/collections.py 81.25% <0.00%> (-3.13%) ⬇️
datalad/tests/test_base.py 97.22% <0.00%> (-2.78%) ⬇️
datalad/cmd.py 91.73% <0.00%> (-2.76%) ⬇️
datalad/__init__.py 84.26% <0.00%> (-1.69%) ⬇️
datalad/tests/utils_testrepos.py 93.27% <0.00%> (-0.85%) ⬇️
... and 13 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c0b2d05...d2288d9. Read the comment docs.

@mih mih added the semver-minor Increment the minor version when merged label Dec 17, 2021
@mih
Copy link
Member Author

mih commented Dec 21, 2021

Reliable failure on windows:

======================================================================
FAIL: datalad.tests.test_config.test_bare
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\Python39-x64\lib\site-packages\nose\case.py", line 198, in runTest
    self.test(*self.arg)
  File "c:\projects\datalad\datalad\tests\utils.py", line 851, in _wrap_with_tempfile
    return t(*(arg + (filename,)), **kw)
  File "c:\projects\datalad\datalad\tests\utils.py", line 851, in _wrap_with_tempfile
    return t(*(arg + (filename,)), **kw)
  File "c:\projects\datalad\datalad\tests\test_config.py", line 682, in test_bare
    assert_equal('surprise!', gr.config.get('datalad.dataset.id'))
AssertionError: 'surprise!' != 'd62fab7b-cb57-40bf-9fd7-a8b232e8dd97'
- surprise!
+ d62fab7b-cb57-40bf-9fd7-a8b232e8dd97

Which I fail to replicate on a real windows box with git version 2.34.1.windows.1 and git-annex version: 8.20211117-gc3af94eff.

@mih mih added the CHANGELOG-missing When a PR's description does not contain a changelog item, yet. label Jan 28, 2022
@mih
Copy link
Member Author

mih commented Jan 28, 2022

If I cannot come back to this within a week, feel free to close.

When pointed to a bare repo, normal behavior for non-committed
config is maintained.

In addition, and replacing the readout of `.datalad/config` from
the worktree, `blob:HEAD:.datalad/config` is read (e.g., the
config committed in the default branch), which is the closest
analog of the worktree-config. Change detection for `reload()`
is also implemented, directly using the gitsha of this file.

Few minor issues are also contained in the changeset:

- missing parenthesis for function call, fixes datalad#6327

- wrong name for source config store, fixes datalad#6331

Alltogether, this fixes datalad#6264
@adswa
Copy link
Member

adswa commented Feb 2, 2022

Windows test failure persists:

======================================================================
FAIL: datalad.tests.test_config.test_bare
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\Python39-x64\lib\site-packages\nose\case.py", line 198, in runTest
    self.test(*self.arg)
  File "c:\projects\datalad\datalad\tests\utils.py", line 850, in _wrap_with_tempfile
    return t(*(arg + (filename,)), **kw)
  File "c:\projects\datalad\datalad\tests\utils.py", line 850, in _wrap_with_tempfile
    return t(*(arg + (filename,)), **kw)
  File "c:\projects\datalad\datalad\tests\test_config.py", line 682, in test_bare
    assert_equal('surprise!', gr.config.get('datalad.dataset.id'))
AssertionError: 'surprise!' != '6160a7af-3df4-4ede-8de0-29cd92155557'
- surprise!
+ 6160a7af-3df4-4ede-8de0-29cd92155557

Failure on travis seems unrelated:

======================================================================
ERROR: datalad.distribution.tests.test_get.test_source_candidate_subdataset
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/tmp/dl-miniconda-lnezowab/lib/python3.9/site-packages/nose/case.py", line 134, in run
    self.runTest(result)
  File "/tmp/dl-miniconda-lnezowab/lib/python3.9/site-packages/nose/case.py", line 152, in runTest
    test(result)
AssertionError: Test was too slow (took 30.2888s, threshold was 30.0000s)

@mih
Copy link
Member Author

mih commented Feb 3, 2022

Windows test failure persists

Yeah, and I cannot make it show locally on windows. Will debug on appveyor....

...and it has nothing to do with windows:

% tools/eval_under_testloopfs python -m nose -s -v datalad.tests.test_config:test_bare
...
Traceback (most recent call last):
  File "/home/mih/env/datalad-dev/lib/python3.9/site-packages/nose/case.py", line 198, in runTest
    self.test(*self.arg)
  File "/home/mih/hacking/datalad/git/datalad/tests/utils.py", line 850, in _wrap_with_tempfile
    return t(*(arg + (filename,)), **kw)
  File "/home/mih/hacking/datalad/git/datalad/tests/utils.py", line 850, in _wrap_with_tempfile
    return t(*(arg + (filename,)), **kw)
  File "/home/mih/hacking/datalad/git/datalad/tests/test_config.py", line 682, in test_bare
    assert_equal('surprise!', gr.config.get('datalad.dataset.id'))
AssertionError: 'surprise!' != 'af879856-c6e0-4681-9c2d-3e7636f999d0'
- surprise!
+ af879856-c6e0-4681-9c2d-3e7636f999d0

The implementation does not consider adjusted mode! And apparently our "crippledfs" workflow does not even run the tests for the config manager.... Thank you windows!
(now makes me wonder, what this windows laptop here does to prevent this from being an issue....)

@mih mih removed the CHANGELOG-missing When a PR's description does not contain a changelog item, yet. label Feb 3, 2022
@qlty-cloud-legacy
Copy link

Code Climate has analyzed commit d2288d9 and detected 1 issue on this pull request.

Here's the issue category breakdown:

Category Count
Complexity 1

View more on Code Climate.

@mih
Copy link
Member Author

mih commented Feb 3, 2022

Travis failure is unrelated #6412

@mih mih merged commit 445d881 into datalad:master Feb 3, 2022
@mih mih deleted the bareconfig branch February 3, 2022 12:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bare-mode Issue regarding operation on bare mode repositories cmd-config(urgation) semver-minor Increment the minor version when merged

Projects

None yet

2 participants