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

dulwich: use untracked_files="no" in is_dirty #74

Merged
merged 1 commit into from
May 31, 2022

Conversation

dtrifiro
Copy link
Contributor

This will speed up calling is_dirty when untracked_files=False

related to #69

@dtrifiro dtrifiro mentioned this pull request May 19, 2022
@dtrifiro dtrifiro force-pushed the feature/use-untracked-files-no branch from ee82286 to 9bab422 Compare May 19, 2022 12:35
@efiop
Copy link
Contributor

efiop commented May 19, 2022

Was this tested with dvc?

@dtrifiro
Copy link
Contributor Author

Was this tested with dvc?

Not yet, why?

@efiop
Copy link
Contributor

efiop commented May 19, 2022

@dtrifiro Well, it is not good if it will break dvc tests 😄 Let's not release this until it is tested.

@dtrifiro
Copy link
Contributor Author

@dtrifiro Well, it is not good if it will break dvc tests smile Let's not release this until it is tested.

😅 indeed, although it does not change existing behaviour. Running tests right now

@dtrifiro
Copy link
Contributor Author

No tests fail when running locally: Works on my machine®

Currently running some CI tests here with scmrepo@main:
https://github.com/dtrifiro/dvc/actions/runs/2352088728

@dtrifiro dtrifiro force-pushed the feature/use-untracked-files-no branch from 9bab422 to 9dc1ceb Compare May 19, 2022 14:37
setup.cfg Outdated Show resolved Hide resolved
@dtrifiro dtrifiro force-pushed the feature/use-untracked-files-no branch from 9dc1ceb to 14bf052 Compare May 19, 2022 15:16
setup.cfg Outdated Show resolved Hide resolved
@dtrifiro dtrifiro force-pushed the feature/use-untracked-files-no branch from 14bf052 to 9befe4f Compare May 25, 2022 07:41
tests/test_git.py Outdated Show resolved Hide resolved
@dtrifiro dtrifiro requested review from pmrowla and efiop May 25, 2022 08:03
@dtrifiro dtrifiro force-pushed the feature/use-untracked-files-no branch 2 times, most recently from 7d249e2 to b4d489f Compare May 26, 2022 07:57
Comment on lines 351 to 352
staged, unstaged, untracked = self.status(**kwargs)
return bool(staged or unstaged or untracked)
Copy link
Member

@skshetry skshetry May 26, 2022

Choose a reason for hiding this comment

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

any makes the intention more clearer.

Suggested change
staged, unstaged, untracked = self.status(**kwargs)
return bool(staged or unstaged or untracked)
staged, unstaged, untracked = self.status(**kwargs)
return any((staged, unstaged, untracked))

You can further simplify this to just:

Suggested change
staged, unstaged, untracked = self.status(**kwargs)
return bool(staged or unstaged or untracked)
return any(self.status(**kwargs))

Comment on lines 1063 to 1064
with (tmp_dir / "foo").open("a") as fobj:
fobj.write("modified")
Copy link
Member

Choose a reason for hiding this comment

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

For consistency,

Suggested change
with (tmp_dir / "foo").open("a") as fobj:
fobj.write("modified")
tmp_dir.gen("foo", "modified")


@pytest.mark.skip_git_backend("pygit2")
@pytest.mark.parametrize("untracked_files", [False, True])
def test_is_dirty(
Copy link
Member

Choose a reason for hiding this comment

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

I'll suggest splitting this test into 2 tests:

  1. test for untracked
  2. test for modify-then-commit.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ended up getting rid of the parametrization and adding more tests for is_dirty

Copy link
Member

Choose a reason for hiding this comment

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

Please try to split these blocks into individual tests if possible.

@dtrifiro dtrifiro force-pushed the feature/use-untracked-files-no branch from b4d489f to 4bebc0f Compare May 26, 2022 11:46
This will speed up calling `is_dirty` with untracked_files=False

related to iterative#69
@dtrifiro dtrifiro force-pushed the feature/use-untracked-files-no branch from 4bebc0f to fe3aa26 Compare May 30, 2022 16:42
@efiop efiop requested a review from skshetry May 31, 2022 09:46
Copy link
Member

@skshetry skshetry left a comment

Choose a reason for hiding this comment

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

LGTM 🙂

@efiop
Copy link
Contributor

efiop commented May 31, 2022

@pmrowla Could you take a final look as well, please?

@pmrowla pmrowla merged commit d191e14 into iterative:main May 31, 2022
@dtrifiro dtrifiro deleted the feature/use-untracked-files-no branch May 31, 2022 14:17
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.

4 participants