Skip to content
Snippets Groups Projects
Commit 73498ce5 authored by Ronald Jäpel's avatar Ronald Jäpel
Browse files

add "add_filetype_to_lfs" convenience function

parent cb4a8cc7
No related branches found
No related tags found
No related merge requests found
......@@ -97,11 +97,9 @@ def add_remote_to_repo(remote_url: str, path_to_repo="."):
@cli.command()
@click.argument('file_type')
def add_file_type_to_lfs(file_type: str, ):
init_lfs(lfs_filetypes=[file_type], path=".")
def add_filetype_to_lfs(file_type: str, ):
repo = BaseRepo(".")
repo.add_all_files()
repo.commit(f"Add {file_type} to lfs")
repo.add_filetype_to_lfs(file_type)
@cli.command()
......
......@@ -15,6 +15,7 @@ from ipylab import JupyterFrontEnd
from tabulate import tabulate
import pandas as pd
from cadetrdm.initialize_repo import init_lfs
from cadetrdm.io_utils import recursive_chmod, write_lines_to_file, wait_for_user
from cadetrdm.jupyter_functionality import Notebook
from cadetrdm.remote_integration import create_gitlab_remote
......@@ -145,7 +146,17 @@ class BaseRepo:
project_repo.add_list_of_remotes_in_readme_file("output_repo", self.remote_urls)
project_repo.commit("Add remote for output repo")
def add_filetype_to_lfs(self, file_type):
"""
Add the filetype given in file_type to the GIT-LFS tracking
:param file_type:
Wildcard formatted string. Examples: "*.png" or "*.xlsx"
:return:
"""
init_lfs(lfs_filetypes=[file_type], path=self.working_dir)
self.add_all_files()
self.commit(f"Add {file_type} to lfs")
def import_remote_repo(self, source_repo_location, source_repo_branch, target_repo_location=None):
"""
......
......@@ -35,3 +35,20 @@ repo.create_gitlab_remotes(
name="e.g. API_test_project"
)
```
## Extending GIT-LFS scope
Several common datatypes are included in GIT-LFS by default. These currently are
`"*.jpg", "*.png", "*.xlsx", "*.h5", "*.ipynb", "*.pdf", "*.docx", "*.zip", "*.html"`
You can add datatypes you require by running:
````python
repo.add_filetype_to_lfs("*.npy")
````
or
````commandline
cadet-rdm add_filetype_to_lfs *.npy
````
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment