Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
CADET-RDM
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
IBG-1
ModSim
CADET
CADET-RDM
Commits
73498ce5
Commit
73498ce5
authored
Dec 18, 2023
by
Ronald Jäpel
Browse files
Options
Downloads
Patches
Plain Diff
add "add_filetype_to_lfs" convenience function
parent
cb4a8cc7
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
cadetrdm/cli_integration.py
+2
-4
2 additions, 4 deletions
cadetrdm/cli_integration.py
cadetrdm/repositories.py
+11
-0
11 additions, 0 deletions
cadetrdm/repositories.py
docs/source/user_guide/getting-started.md
+17
-0
17 additions, 0 deletions
docs/source/user_guide/getting-started.md
with
30 additions
and
4 deletions
cadetrdm/cli_integration.py
+
2
−
4
View file @
73498ce5
...
...
@@ -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
()
...
...
This diff is collapsed.
Click to expand it.
cadetrdm/repositories.py
+
11
−
0
View file @
73498ce5
...
...
@@ -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
):
"""
...
...
This diff is collapsed.
Click to expand it.
docs/source/user_guide/getting-started.md
+
17
−
0
View file @
73498ce5
...
...
@@ -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
````
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment