Skip to content
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

RF update (focus: single dataset operations) #1304

Merged
merged 26 commits into from
Feb 19, 2017
Merged

Conversation

mih
Copy link
Member

@mih mih commented Feb 15, 2017

update is now practically a frontend for annex sync.

Please comment @bpoldrack @yarikoptic

From my PoV this step is complete. There is more TODO, (#1199) but there is no need to wait for it .

@mih mih mentioned this pull request Feb 15, 2017
20 tasks
@codecov-io
Copy link

codecov-io commented Feb 16, 2017

Codecov Report

Merging #1304 into master will decrease coverage by 0.01%.
The diff coverage is 94.9%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1304      +/-   ##
==========================================
- Coverage   89.18%   89.16%   -0.02%     
==========================================
  Files         237      237              
  Lines       24293    24396     +103     
==========================================
+ Hits        21666    21753      +87     
- Misses       2627     2643      +16
Impacted Files Coverage Δ
datalad/support/gitrepo.py 85.33% <ø> (-1.42%) ⬇️
datalad/distribution/add.py 94.73% <ø> (ø) ⬆️
datalad/distribution/tests/test_update.py 100% <100%> (ø) ⬆️
datalad/distribution/tests/test_uninstall.py 99.55% <100%> (ø) ⬆️
datalad/distribution/uninstall.py 99.37% <100%> (ø) ⬆️
datalad/distribution/update.py 83.82% <80.55%> (-8.12%) ⬇️
datalad/support/annexrepo.py 89.11% <94.73%> (+0.07%) ⬆️

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 b83eedb...b0ee250. Read the comment docs.

@mih mih changed the title RF update (starts small, gets big later) RF update (focus: single dataset operations) Feb 17, 2017
@mih
Copy link
Member Author

mih commented Feb 17, 2017

Hmm, 'thighting"... sounds good, will do that more

@mih
Copy link
Member Author

mih commented Feb 18, 2017

Ok, this works better than what we had before. I will merge this some time this weekend.

testfname = opj(ds.path, 'load.dat')
assert_false(ds.repo.file_has_content(testfname))
ds.get('.')
ok_file_has_content(opj(ds.path, 'load.dat'), 'heavy')
Copy link
Member

Choose a reason for hiding this comment

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

I'm a bit confused here. 'load.dat' was originally added to a plain git repo in line 152, right?
Where is the point it became an annexed file, that we are able to annex-get?

Copy link
Member Author

Choose a reason for hiding this comment

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

Indeed. Evolution of that test somewhat distorted the original idea. Conveniently, ds.repo.file_has_content(testfname) returns False for a file that is guaranteed to have its content with it. So we can leave it as is!

# annex, would would be the case when we presently have a git repo
# and the recent fetch brought evidence for a remote annex
if not isinstance(repo, AnnexRepo) and knows_annex(repo.path):
lgr.info("Init annex at '%s' prior merge.", repo.path)
Copy link
Member

Choose a reason for hiding this comment

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

I think, this should be done be re-requesting ds.repo, since that property already has a check for whether it became an annex. This check in Dataset.repo should use knows_annex though, since it currently is just looking for a local git-annex' branch.

Copy link
Member Author

Choose a reason for hiding this comment

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

I assume you meant something like this:

diff --git a/datalad/distribution/update.py b/datalad/distribution/update.py
index 49a03c28..fe814705 100644
--- a/datalad/distribution/update.py
+++ b/datalad/distribution/update.py
@@ -145,7 +145,9 @@ def _update_repo(ds, remote, merge, fetch_all, reobtain_data):
     # and the recent fetch brought evidence for a remote annex
     if not isinstance(repo, AnnexRepo) and knows_annex(repo.path):
         lgr.info("Init annex at '%s' prior merge.", repo.path)
-        repo = AnnexRepo(repo.path, create=False)
+        # re-requesting the repo will notice the type change
+        ds._repo = None
+        repo = ds.repo
     lgr.info("Merging updates...")
     if isinstance(repo, AnnexRepo):
         if reobtain_data:

('content', content)):
args.append('--{}{}'.format('' if arg else 'no-', label))
for label, arg in (('all', all), ('fast', fast)):
if arg:
Copy link
Member

Choose a reason for hiding this comment

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

lines 1143 - 1146 are equivalent to:

from datalad.support.gitrepo import to_options
args.extend(to_options(all=all, fast=fast))

Just saying - we should use it more often ;-)

Copy link
Member

Choose a reason for hiding this comment

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

For the more complex thing above (--no-something vs --something) it could also be used:

to_options(push=push, no_push=not push, ...)

Copy link
Member Author

Choose a reason for hiding this comment

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

Did the first. For the second I would need to be convinced that a causal reader has an easier time decoding with it wants to say compared to the present implementation.

@mih
Copy link
Member Author

mih commented Feb 19, 2017

Well, that went south quickly

https://travis-ci.org/datalad/datalad/jobs/203121067

I will revert the changes and repush. When there is more time, we can investigate why exactly the predicted behavior was not the observed one.

@mih
Copy link
Member Author

mih commented Feb 19, 2017

So in summary, I reverted all changes that I made in response to Ben's comments. I will merge this now, as it is still better than what it was. I won't have time to get to this again this week and I don't won't to have it dangling...

@mih mih merged commit 242f426 into datalad:master Feb 19, 2017
@bpoldrack bpoldrack mentioned this pull request Feb 20, 2017
@yarikoptic yarikoptic added this to the Release 0.5 milestone Mar 10, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants