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

[AL-1598] Added more APIs for VC #1371

Merged
merged 6 commits into from
Dec 4, 2021
Merged

[AL-1598] Added more APIs for VC #1371

merged 6 commits into from
Dec 4, 2021

Conversation

AbhinavTuli
Copy link
Contributor

@AbhinavTuli AbhinavTuli commented Dec 2, 2021

🚀 🚀 Pull Request

Checklist:

  • My code follows the style guidelines of this project and the Contributing document
  • I have commented my code, particularly in hard-to-understand areas
  • I have kept the coverage-rate up
  • I have performed a self-review of my own code and resolved any problems
  • I have checked to ensure there aren't any other open Pull Requests for the same change
  • I have described and made corresponding changes to the relevant documentation
  • New and existing unit tests pass locally with my changes

Changes

Adds:-
ds.branches - returns a list of all branches of the dataset
ds.commits - returns a list of dictionaries, each containing all info about a particular commit (commit_id, commit_message, username and time), in order for the current branch.
ds.diff(a,b,as_dict=True) - returns dicts containing diffs instead of printing it.
ds.get_commit_details(commit_id) - returns a dict with all the details for a particular commit_id (commit_message, username and time)

Need to add tests

@AbhinavTuli AbhinavTuli changed the title Added more API calls for VC [AL-1598] Added more APIs for VC Dec 2, 2021
@codecov
Copy link

codecov bot commented Dec 3, 2021

Codecov Report

Merging #1371 (80cae87) into main (ed28761) will increase coverage by 0.06%.
The diff coverage is 99.33%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1371      +/-   ##
==========================================
+ Coverage   92.68%   92.75%   +0.06%     
==========================================
  Files         173      173              
  Lines       12533    12667     +134     
==========================================
+ Hits        11616    11749     +133     
- Misses        917      918       +1     
Flag Coverage Δ
unittests 92.75% <99.33%> (+0.06%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
hub/core/dataset/dataset.py 93.93% <95.83%> (+0.09%) ⬆️
hub/core/version_control/test_version_control.py 99.83% <100.00%> (+0.03%) ⬆️
hub/util/diff.py 98.37% <100.00%> (-0.06%) ⬇️

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 ed28761...80cae87. Read the comment docs.

hub/core/dataset/dataset.py Show resolved Hide resolved
hub/core/dataset/dataset.py Show resolved Hide resolved
hub/core/dataset/dataset.py Outdated Show resolved Hide resolved
commits = []
commit_node = self.version_state["commit_node"]
while commit_node:
if commit_node.commit_time is not None:
Copy link
Contributor

Choose a reason for hiding this comment

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

In what scenario is commit_time == None? What is being checked here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

commit_time is None when the commit hasn't been made yet i.e. we're on the head commit

Copy link
Contributor

Choose a reason for hiding this comment

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

For better readability, maybe:

is_head_commit = lambda node: node.commit_time is None

...
    if not is_head_commit(commit_node):
        ...

hub/core/version_control/test_version_control.py Outdated Show resolved Hide resolved
hub/core/version_control/test_version_control.py Outdated Show resolved Hide resolved
hub/util/diff.py Outdated Show resolved Hide resolved
hub/util/diff.py Outdated Show resolved Hide resolved
commits = []
commit_node = self.version_state["commit_node"]
while commit_node:
if commit_node.commit_time is not None:
Copy link
Contributor

Choose a reason for hiding this comment

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

For better readability, maybe:

is_head_commit = lambda node: node.commit_time is None

...
    if not is_head_commit(commit_node):
        ...

@tatevikh tatevikh merged commit 55151dd into main Dec 4, 2021
@tatevikh tatevikh deleted the vc/add_apis branch December 4, 2021 20:08
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