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

cli for plumbing commands #79

Merged
merged 1 commit into from Jul 2, 2022
Merged

cli for plumbing commands #79

merged 1 commit into from Jul 2, 2022

Conversation

skshetry
Copy link
Member

@skshetry skshetry commented Jul 2, 2022

This PR introduces several plumbing CLI commands for dvc-data.

  1. fsck: Checks all of the objects in the database, similar to git fsck.
  2. ls: List all items of the tree, similar to git ls-tree.
  3. stage: Stage, and optionally write objects to database with --write/-w. Can write in shallow mode with --shallow.
  4. cat: Print contents of the object to the terminal (and optionally verify object with --check/-c.
  5. p2o/o2p -> Path to oid and Oid to path.
  6. genrand -> Generate file with random content (eg: ./cli.py genrand sample.txt 1GB).
  7. gensparse -> Create sparse file in a portable way (eg: ./cli.py gensparse sample.txt 1GB).
  8. hash -> Compute hashes of file, in --text (dos2unix) vs --binary mode, with different hashing algorithms specified via --name/-n.
    (./cli.py hash sample.txt -n blake2b --progress --text)

These are small programs meant to assist for local testing/development.

Installation

pip install -e ".[dev]"

Usage:

./cli.py <command> <args>

The default odb is created in .dvc/cache folder relative to current working directory by default. Most of the commands take --db option, that can be used to pass any alternative odb locations. You can also set ODB_PATH envvar so that you don't need to provide that again and again on the commands.
eg:

export ODB_PATH=$(mktemp -d)

@skshetry skshetry requested a review from efiop July 2, 2022 16:57
@codecov-commenter
Copy link

codecov-commenter commented Jul 2, 2022

Codecov Report

Merging #79 (baf19c0) into main (f8cf9e3) will not change coverage.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##             main      #79   +/-   ##
=======================================
  Coverage   34.32%   34.32%           
=======================================
  Files          33       33           
  Lines        1681     1681           
  Branches      302      302           
=======================================
  Hits          577      577           
  Misses       1091     1091           
  Partials       13       13           
Impacted Files Coverage Δ
src/dvc_data/hashfile/hash.py 59.22% <100.00%> (ø)

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 f8cf9e3...baf19c0. Read the comment docs.

@efiop efiop merged commit 3e0362a into main Jul 2, 2022
@skshetry skshetry deleted the cli branch July 3, 2022 01:51
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

3 participants