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

Better hint when a sibling is provided without --to #5726

Merged
merged 8 commits into from Jun 21, 2021

Conversation

adswa
Copy link
Member

@adswa adswa commented Jun 9, 2021

This is an attempt to fix #5712. If

  • a path is given,
  • but not --to,
  • (a part of) the path matches a known sibling,
  • and no matching files are found,

push reports "impossible" instead of "notneeded", and issues a hint to the user.

Before:
Screenshot from 2021-06-09 16-29-15

After:
Screenshot from 2021-06-09 16-28-58

@codecov
Copy link

codecov bot commented Jun 9, 2021

Codecov Report

Merging #5726 (3e3d6bd) into master (0b0e7fe) will decrease coverage by 1.94%.
The diff coverage is 88.00%.

❗ Current head 3e3d6bd differs from pull request most recent head a46f21e. Consider uploading reports for the commit a46f21e to get more accurate results
Impacted file tree graph

@@            Coverage Diff             @@
##           master    #5726      +/-   ##
==========================================
- Coverage   90.63%   88.69%   -1.95%     
==========================================
  Files         308      305       -3     
  Lines       42168    42153      -15     
==========================================
- Hits        38220    37387     -833     
- Misses       3948     4766     +818     
Impacted Files Coverage Δ
datalad/local/add_readme.py 92.98% <ø> (ø)
datalad/core/distributed/push.py 92.51% <66.66%> (-0.98%) ⬇️
datalad/core/distributed/clone.py 92.07% <100.00%> (+0.11%) ⬆️
datalad/core/distributed/tests/test_clone.py 97.34% <100.00%> (+0.01%) ⬆️
datalad/core/distributed/tests/test_push.py 98.93% <100.00%> (-0.22%) ⬇️
datalad/local/tests/test_add_readme.py 100.00% <100.00%> (ø)
datalad/plugin/wtf.py 0.00% <0.00%> (-100.00%) ⬇️
datalad/plugin/addurls.py 0.00% <0.00%> (-100.00%) ⬇️
datalad/plugin/no_annex.py 0.00% <0.00%> (-100.00%) ⬇️
datalad/plugin/add_readme.py 0.00% <0.00%> (-100.00%) ⬇️
... and 79 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 0b0e7fe...a46f21e. Read the comment docs.

@@ -229,7 +229,13 @@ def __call__(
if sr
else 'No targets configured in dataset.'))
return

potential_remote = False
if not to and path:
Copy link
Member

Choose a reason for hiding this comment

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

May be that should be relevant only, if the path doesn't actually exist?

Copy link
Member Author

Choose a reason for hiding this comment

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

good point. I moved it down into the if not matched_anything section.

Copy link
Member

@bpoldrack bpoldrack left a comment

Choose a reason for hiding this comment

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

Messaging is fine that way. I'm not convinced of the result change, though. What's specified remains (technically) a path that couldn't be matched. I wouldn't know why this should yield impossible just because it happens to (also) be a remote name, while it's notneeded if it's an arbitrary not matched path.

@adswa
Copy link
Member Author

adswa commented Jun 10, 2021

Messaging is fine that way. I'm not convinced of the result change, though. What's specified remains (technically) a path that couldn't be matched. I wouldn't know why this should yield impossible just because it happens to (also) be a remote name, while it's notneeded if it's an arbitrary not matched path.

I oriented myself at how the case of a push without --to is handled, which also yields an "impossible" result.

@bpoldrack
Copy link
Member

I oriented myself at how the case of a push without --to is handled, which also yields an "impossible" result.

I see. But that's not (necessarily) the case here. The target could be auto-detectable (one existing remote only). In fact, if it wasn't we would fail impossible before (the yield from _push above your changes) and not get to that part of the code.
So, I'd stay in-line with the other if not matched_anything-result.

@bpoldrack
Copy link
Member

Arguably, we could distinguish the cases where not matched actually means - doesn't exist from "no changes" and yield impossible in the former case, but this should then apply generally, not just in the case where the not existing path happens to also be a remote name.

Copy link
Member

@mih mih left a comment

Choose a reason for hiding this comment

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

Thx! I think this will improve UX!

I left a few comments on some possible optimizations.

@@ -229,7 +229,6 @@ def __call__(
if sr
else 'No targets configured in dataset.'))
return

Copy link
Member

Choose a reason for hiding this comment

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

Noooo... my favorite empty line...why did it have to die....life is not fair...it feels so meaningless... ;-)

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 will bring it back to life ;-)

datalad/core/distributed/push.py Outdated Show resolved Hide resolved
datalad/core/distributed/push.py Show resolved Hide resolved
datalad/core/distributed/push.py Outdated Show resolved Hide resolved
@adswa
Copy link
Member Author

adswa commented Jun 14, 2021

I have reused the hints framework that push's custom result renderer uses now. Here is how it looks like:

Screenshot from 2021-06-14 13-43-38

@adswa
Copy link
Member Author

adswa commented Jun 14, 2021

The failure of one AppVeyor run seems unrelated

@bpoldrack
Copy link
Member

The failure of one AppVeyor run seems unrelated

Failed during setup. Restarted.

Copy link
Member

@mih mih left a comment

Choose a reason for hiding this comment

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

This looks good to me now! Thx!

@mih mih merged commit 2e2027b into datalad:master Jun 21, 2021
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.

datalad push <something> is most likely wrong
3 participants