You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The skipped tests do not seem to be the core issue (or cover them). I also saw that the error handling is different between super and subdatasets
❯ datalad clone git@github.com:psychoinformatics-de/paper-remodnav.git
❯ datalad update --how reset
update(impossible): . (dataset) [Updating via 'reset' is incompatible with adjusted branches]
❯ datalad update --how ff-only
update(impossible): . (dataset) [Updating via 'ff-only' is incompatible with adjusted branches]
❯ datalad update --how checkout
update(impossible): . (dataset) [Updating via 'checkout' is incompatible with adjusted branches]
❯ datalad update --how merge
update.annex_sync(ok): . (dataset) [Ran git-annex-sync]
update(ok): . (dataset)
So this is good. Running this any number of times is also not an issue.
The handling for a subdataset is different:
(in that same superdataset)
❯ datalad get -n data/raw_eyegaze
install(ok): /media/mih/Samsung_T5/datalad-tests/paper-remodnav/data/raw_eyegaze (dataset) [Installed subdataset in order to get /media/mih/Samsung_T5/datalad-tests/paper-remodnav/data/raw_eyegaze]
# cd to avoid any possible complication introduced by subdataset handling
❯ cd data/raw_eyegaze
❯ datalad update --how merge
[INFO ] Fetching updates for Dataset(/media/mih/Samsung_T5/datalad-tests/paper-remodnav/data/raw_eyegaze)
CommandError: 'git -c diff.ignoreSubmodules=none -c core.quotepath=false rev-parse --symbolic-full-name --abbrev-ref=strict '@{upstream}'' failed with exitcode 128
fatal: no upstream configured for branch 'adjusted/master(unlocked)'
Running update any number of times give the same outcome.
Right now it is unclear to me, whether this is caused by the subdataset actually having things to update (while the superdataset was freshly cloned and did not have things to merge).
HUGE THANKS to the one who wrote the comment!
Edit: This goes to @kyleam76a7283
> /home/mih/hacking/datalad/git/datalad/distribution/update.py(482)_choose_update_target()
-> target = repo.call_git_oneline(
(Pdb) l
477 # In this scenario, it's tempting to use FETCH_HEAD as the target. For
478 # a merge, that would be the equivalent of 'git pull REMOTE'. But doing
479 # so would be problematic when the GitRepo.fetch() call was passed
480 # all_=True. Given we can't use FETCH_HEAD, it's tempting to use the
481 # branch.*.merge value, but that assumes a value for remote.*.fetch.
482 -> target = repo.call_git_oneline(
483 ["rev-parse", "--symbolic-full-name", "--abbrev-ref=strict",
484 "@{upstream}"],
485 read_only=True)
486 elif branch:
487 remote_branch = "{}/{}".format(remote, branch)
(Pdb) p repo
AnnexRepo('/media/mih/Samsung_T5/datalad-tests/paper-remodnav/data/raw_eyegaze')
(Pdb) p branch
'adjusted/master(unlocked)'
(Pdb) p remote
'origin'
(Pdb) p cfg_remote
'origin'
So we want to change that from
❯ git rev-parse --symbolic-full-name --abbrev-ref=strict @{upstream}
fatal: no upstream configured for branch 'adjusted/master(unlocked)'
I suspect the reason that we do not see this breakage in the tests is that we only test in-sync, i.e. update source and target are jointly in adjusted mode, or not.
It is not that simple. I cannot show the breakage when forcing a dataset into adjusted mode AFTER clone created a normal mode repository. It does not matter whether it is a superdataset or a subdataset.
Using the reproducer from above as a test case is way too heavy.
But this one works always, on crippled FS or not:
diff --git a/datalad/distribution/tests/test_update.py b/datalad/distribution/tests/test_update.py
index befcd4077..23438199f 100644
--- a/datalad/distribution/tests/test_update.py+++ b/datalad/distribution/tests/test_update.py@@ -61,6 +61,8 @@ from datalad.utils import (
from ..dataset import Dataset
+common_kwargs = {'result_renderer': 'disabled'}+
@slow
@with_tempfile(mkdir=True)
@@ -1120,3 +1121,35 @@ def test_update_fetch_failure(path=None):
status="ok",
path=ds_b.path,
action="update")
+++def test_update_adjusted_from_any(tmp_path):+ src = Dataset(tmp_path / "src").create(**common_kwargs)+ cln = clone(source=src, path=tmp_path / 'cln', **common_kwargs)+ # we force the clone into adjusted mode to be able to+ # also test source and clone being in different modes+ cln.repo.call_annex(['adjust', '--unlock'])++ # now modify the source and update+ testfile = 'testfile'+ (src.pathobj / testfile).write_text(testfile)+ src.save(**common_kwargs)+ cln.update(how='merge', **common_kwargs)+ # we are in adjusted mode, any annexed file in the clone should+ # be a real file, not just a symlink, regardless of content presence+ assert (cln.pathobj / testfile).exists()++ # now we add a subdataset at the source, clone it, and also force the+ # clone into adjusted mode+ subds = src.create('sub', **common_kwargs)+ cln.update(how='merge', **common_kwargs)+ subdscln = cln.get(+ 'sub', get_data=False,+ result_xfm='datasets', return_type='item-or-list', **common_kwargs)+ subdscln.repo.call_annex(['adjust', '--unlock'])++ # now we modify the subdataset+ (subds.pathobj / testfile).write_text(testfile)+ src.save(recursive=True, **common_kwargs)+ cln.update(recursive=True, how='merge', **common_kwargs)+ assert (subdscln.pathobj / testfile).exists()
Activity
[-]`update --how-subds reset` cannot handle adjusted branches[/-][+]`update --how(-subds) (!=fetch)` cannot handle adjusted branches[/+]mih commentedon Oct 24, 2023
Looking through the tests, this is known for some time, and the tests are configured to be skipped.
mih commentedon Oct 25, 2023
The skipped tests do not seem to be the core issue (or cover them). I also saw that the error handling is different between super and subdatasets
So this is good. Running this any number of times is also not an issue.
The handling for a subdataset is different:
(in that same superdataset)
Running
updateany number of times give the same outcome.Right now it is unclear to me, whether this is caused by the subdataset actually having things to update (while the superdataset was freshly cloned and did not have things to merge).
mih commentedon Oct 25, 2023
So here is the piece that blows up
HUGE THANKS to the one who wrote the comment!
Edit: This goes to @kyleam 76a7283
So we want to change that from
to
where
masteris the return value ofrepo.get_corresponding_branch(branch)So taken together, the following patch fixes the issue, at least for this particular case:
mih commentedon Oct 25, 2023
I suspect the reason that we do not see this breakage in the tests is that we only test in-sync, i.e. update source and target are jointly in adjusted mode, or not.
mih commentedon Oct 25, 2023
It is not that simple. I cannot show the breakage when forcing a dataset into adjusted mode AFTER
clonecreated a normal mode repository. It does not matter whether it is a superdataset or a subdataset.Using the reproducer from above as a test case is way too heavy.
But this one works always, on crippled FS or not:
mih commentedon Oct 25, 2023
It is also not about the clone into adjusted mode. This test implementation also always works
mih commentedon Oct 25, 2023
Even this one does work all the time
mih commentedon Oct 25, 2023
So bottom-line, the only way to reproduce ATM is:
on a crippled FS
and with the patch
the same code works, and updates the subdataset.
Robustify update target detection for adjusted mode datasets