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
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
06242c69
Commit
06242c69
authored
1 year ago
by
Ronald Jäpel
Browse files
Options
Downloads
Patches
Plain Diff
change default branch from "master" to "main"
parent
d3b133d6
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
cadetrdm/initialize_repo.py
+1
-1
1 addition, 1 deletion
cadetrdm/initialize_repo.py
cadetrdm/repositories.py
+21
-21
21 additions, 21 deletions
cadetrdm/repositories.py
with
22 additions
and
22 deletions
cadetrdm/initialize_repo.py
+
1
−
1
View file @
06242c69
...
...
@@ -114,7 +114,7 @@ def initialize_git(folder="."):
if
not
proceed
:
raise
KeyboardInterrupt
except
git
.
exc
.
InvalidGitRepositoryError
:
os
.
system
(
f
"
git init
"
)
os
.
system
(
f
"
git init
-b main
"
)
if
folder
!=
"
:
"
:
os
.
chdir
(
starting_directory
)
...
...
This diff is collapsed.
Click to expand it.
cadetrdm/repositories.py
+
21
−
21
View file @
06242c69
...
...
@@ -132,10 +132,10 @@ class BaseRepo:
# This folder is a project repo. Use a project repo class to easily access the output repo.
output_repo
=
ProjectRepo
(
self
.
working_dir
).
output_repo
if
output_repo
.
active_branch
!=
"
ma
ster
"
:
if
output_repo
.
active_branch
!=
"
ma
in
"
:
if
output_repo
.
exist_uncomitted_changes
:
output_repo
.
stash_all_changes
()
output_repo
.
checkout
(
"
ma
ster
"
)
output_repo
.
checkout
(
"
ma
in
"
)
output_repo
.
add_list_of_remotes_in_readme_file
(
"
project_repo
"
,
self
.
remote_urls
)
output_repo
.
commit
(
"
Add remote for project repo
"
)
...
...
@@ -340,18 +340,18 @@ class BaseRepo:
def
delete_active_branch_if_branch_is_empty
(
self
):
"""
Delete the currently active branch and checkout the ma
ster
branch
Delete the currently active branch and checkout the ma
in
branch
:return:
"""
previous_branch
=
self
.
active_branch
.
name
if
previous_branch
==
"
ma
ster
"
:
if
previous_branch
==
"
ma
in
"
:
return
commit_of_current_ma
ster
=
str
(
self
.
_git
.
rev_parse
(
"
ma
ster
"
))
commit_of_current_ma
in
=
str
(
self
.
_git
.
rev_parse
(
"
ma
in
"
))
commit_of_current_branch
=
str
(
self
.
head
.
commit
)
if
commit_of_current_branch
==
commit_of_current_ma
ster
:
if
commit_of_current_branch
==
commit_of_current_ma
in
:
print
(
"
Removing empty branch
"
,
previous_branch
)
self
.
_git
.
checkout
(
"
ma
ster
"
)
self
.
_git
.
checkout
(
"
ma
in
"
)
self
.
_git
.
branch
(
"
-d
"
,
previous_branch
)
def
add_all_files
(
self
,
automatically_add_new_files
=
True
):
...
...
@@ -480,14 +480,14 @@ class BaseRepo:
def
prepare_new_branch
(
self
,
branch_name
):
"""
Prepares a new branch to recieve data. This includes:
- checking out the ma
ster
branch,
- checking out the ma
in
branch,
- creating a new branch from there
This thereby produces a clear, empty directory for data, while still maintaining
.gitignore and .gitattributes
:param branch_name:
Name of the new branch.
"""
self
.
_git
.
checkout
(
"
ma
ster
"
)
self
.
_git
.
checkout
(
"
ma
in
"
)
self
.
_git
.
checkout
(
'
-b
'
,
branch_name
)
# equivalent to $ git checkout -b %branch_name
code_backup_path
=
self
.
working_dir
/
"
run_history
"
logs_path
=
self
.
working_dir
/
"
log.tsv
"
...
...
@@ -662,12 +662,12 @@ class ProjectRepo(BaseRepo):
branch_name
=
"
_
"
.
join
([
timestamp
,
self
.
_output_folder
,
"
from
"
,
str
(
self
.
active_branch
),
project_repo_hash
[:
7
]])
return
branch_name
def
check_results_ma
ster
(
self
):
def
check_results_ma
in
(
self
):
"""
Checkout the ma
ster
branch, which contains all the log files.
Checkout the ma
in
branch, which contains all the log files.
"""
self
.
_most_recent_branch
=
self
.
_output_repo
.
active_branch
.
name
self
.
_output_repo
.
_git
.
checkout
(
"
ma
ster
"
)
self
.
_output_repo
.
_git
.
checkout
(
"
ma
in
"
)
def
reload_recent_results
(
self
):
"""
...
...
@@ -735,10 +735,10 @@ class ProjectRepo(BaseRepo):
lines
=
[
"
rdm-log.tsv merge=union
"
],
open_type
=
"
a
"
)
def
update_output_ma
ster
_logs
(
self
,
):
def
update_output_ma
in
_logs
(
self
,
):
"""
Dumps all the metadata information about the project repositories state and
the commit hash and branch name of the ouput repository into the ma
ster
branch of
the commit hash and branch name of the ouput repository into the ma
in
branch of
the output repository.
"""
output_branch_name
=
str
(
self
.
_output_repo
.
active_branch
)
...
...
@@ -747,7 +747,7 @@ class ProjectRepo(BaseRepo):
output_commit_message
=
self
.
_output_repo
.
active_branch
.
commit
.
message
output_commit_message
=
output_commit_message
.
replace
(
"
\n
"
,
"
;
"
)
self
.
_output_repo
.
_git
.
checkout
(
"
ma
ster
"
)
self
.
_output_repo
.
_git
.
checkout
(
"
ma
in
"
)
logs_folderpath
=
self
.
working_dir
/
self
.
_output_folder
/
"
run_history
"
/
output_branch_name
if
not
logs_folderpath
.
exists
():
...
...
@@ -958,8 +958,8 @@ class ProjectRepo(BaseRepo):
new_branch_name
=
self
.
get_new_output_branch_name
()
# update urls in ma
ster
branch of output_repo
output_repo
.
_git
.
checkout
(
"
ma
ster
"
)
# update urls in ma
in
branch of output_repo
output_repo
.
_git
.
checkout
(
"
ma
in
"
)
project_repo_remotes
=
self
.
remote_urls
output_repo
.
add_list_of_remotes_in_readme_file
(
"
project_repo
"
,
project_repo_remotes
)
output_repo
.
commit
(
"
Update urls
"
)
...
...
@@ -1008,7 +1008,7 @@ class ProjectRepo(BaseRepo):
- Ensure no uncommitted changes in the project repository
- Stage all changes in the output repository
- Commit all changes in the output repository with the given commit message.
- Update the log files in the ma
ster
branch of the output repository.
- Update the log files in the ma
in
branch of the output repository.
:param message:
Commit message for the output repository commit.
"""
...
...
@@ -1022,8 +1022,8 @@ class ProjectRepo(BaseRepo):
# This has to be using ._git.commit to raise an error if no results have been written.
commit_return
=
self
.
output_repo
.
_git
.
commit
(
"
-m
"
,
message
)
self
.
copy_data_to_cache
()
self
.
update_output_ma
ster
_logs
()
self
.
copy_data_to_cache
(
"
ma
ster
"
)
self
.
update_output_ma
in
_logs
()
self
.
copy_data_to_cache
(
"
ma
in
"
)
print
(
"
\n
"
+
commit_return
+
"
\n
"
)
except
git
.
exc
.
GitCommandError
as
e
:
self
.
output_repo
.
delete_active_branch_if_branch_is_empty
()
...
...
@@ -1067,7 +1067,7 @@ class ProjectRepo(BaseRepo):
class
OutputRepo
(
BaseRepo
):
def
print_data_log
(
self
):
self
.
checkout
(
"
ma
ster
"
)
self
.
checkout
(
"
ma
in
"
)
tsv_filepath
=
self
.
working_dir
/
"
log.tsv
"
...
...
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