-
Notifications
You must be signed in to change notification settings - Fork 111
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
Generator-based GitRepo.call_git_items_() #6278
Generator-based GitRepo.call_git_items_() #6278
Conversation
ccfc2e3
to
893769f
Compare
Codecov Report
@@ Coverage Diff @@
## master #6278 +/- ##
==========================================
- Coverage 89.84% 88.53% -1.31%
==========================================
Files 329 329
Lines 42867 42936 +69
==========================================
- Hits 38512 38013 -499
- Misses 4355 4923 +568
Continue to review full report at Codecov.
|
Are you planning to re-consolidate the additions to |
Yes, I will do that now. |
@mih: The latest commit consolidates The changes implement a drop-in replacement in order to keep the PR small, i.e. only very few changes outside of
Having said that, I will create an issue to clean up the usage of |
f224f47
to
ec7ee65
Compare
I do not fully understand your last post. I can confirm that this code works, and is at least as fast as it was before. So all these signs point to a quick merge. What I do not understand yet (and I assume this is what your last post was about), it why we have This leads to possibly undesirable situations, like FTR: unlike the other methods, |
Use context managers to factor out common code from GitRepo._call_git and GitRepo.call_git_items_()
I should have been clearer. Top priority in this PR was to keep it small and therefore keep internal and external APIs unmodified.
With the aim of keeping
Although the general complexity (O-Notation) remains the same for the same inputs, the additional method call might very well introduce some delay, i.e. increase a constant factor. That can be mitigated by cutting out
Its return value is directly returned by |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a pretty cool pattern to hide-away the try-except complexities! Awesome!
I left a suggestion to generalize the lock-helper a bit further to be able to take it out of the context of GitRepo. WDYT?
Co-authored-by: Michael Hanke <michael.hanke@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From my POV we can run with this! Thx!
The MacOS failure is more fundamental #6285 |
Hey @christian-monch waving for attention 👋 diff --git a/datalad/dataset/gitrepo.py b/datalad/dataset/gitrepo.py
index a1e32b450..d7b831bca 100644
--- a/datalad/dataset/gitrepo.py
+++ b/datalad/dataset/gitrepo.py
@@ -429,12 +429,12 @@ class GitRepo(RepoInterface, metaclass=PathBasedFlyweight):
------
CommandError if the call exits with a non-zero status.
"""
- return "\n".join(
- self.call_git_items_(args,
- files,
- expect_stderr=expect_stderr,
- expect_fail=expect_fail,
- read_only=read_only))
+
+ return self._call_git(args,
+ files,
+ expect_stderr=expect_stderr,
+ expect_fail=expect_fail,
+ read_only=read_only)[0]
def call_git_items_(self,
args, There were also a few comments by @yarikoptic in the chat:
and
|
…ng slashes Rational is in datalad#6278 (comment)
…ng slashes Rational is in datalad#6278 (comment)
This PR uses a generator-based runner to, i.e. a runner with a
GeneratorMixIn
-Protocol subclass, to implementGitRepo.call_git_items_()
.This is a follow up to PR #6244, especially the following reviewer comment: #6244 (comment)
The interface of
GitRepo.call_git_items_()
does not change, but results will be yielded as soon as they are available.