-
Notifications
You must be signed in to change notification settings - Fork 11
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
Checkout edits #249
Open
kiihne-noaa
wants to merge
21
commits into
main
Choose a base branch
from
checkout_edits
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Checkout edits #249
Changes from 3 commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
e063d85
checkout updated for issue #174
6e701aa
Update checkoutScript.py
kiihne-noaa b9c9d01
Update checkoutScript.py
kiihne-noaa 582592f
added exit if local branch is not branch request
kiihne-noaa a2f536f
fixed bracket
kiihne-noaa 6919bd0
Merge branch 'main' into checkout_edits
3a7f378
tags version
0ac0322
Update __init__.py with version
kiihne-noaa 8a67e19
added version checker #174
kiihne-noaa 438492c
Merge branch 'precompute-workflow.247' of github.com:NOAA-GFDL/fre-cl…
64d5cc8
git fixes
f1756d8
wrapper logic reworked #174
f161cd7
Update checkoutScript.py
kiihne-noaa 1c0a531
varous small improvemnets to address comments
kiihne-noaa f91514c
Update checkoutScript.py
kiihne-noaa fe1078d
reviewing checkoutScript.py
kiihne-noaa a6d6a82
syntax change
kiihne-noaa a34f559
removed outdated aspects
kiihne-noaa 19a7e2a
testing
8f8d17f
spelling change
kiihne-noaa e658eb7
Update checkoutScript.py
kiihne-noaa File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,7 +20,7 @@ | |
|
||
############################################# | ||
|
||
def _checkoutTemplate(experiment, platform, target, branch='empty'): | ||
def _checkoutTemplate(experiment, platform, target, branch=None): | ||
""" | ||
Checkout the workflow template files from the repo | ||
""" | ||
|
@@ -36,11 +36,12 @@ def _checkoutTemplate(experiment, platform, target, branch='empty'): | |
|
||
# branch and version parameters | ||
default_tag = subprocess.run(["fre","--version"],capture_output=True, text=True).stdout.split()[2] | ||
if branch != 'empty': | ||
if branch == None: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: |
||
if os.path.isdir(name): #scenario 4 | ||
os.chdir(name) | ||
name_path_tag=subprocess.run(["git","describe","--tags"],capture_output=True, text=True).stdout | ||
name_path_branch=subprocess.run(["git","branch"],capture_output=True, text=True).stdout.split()[1] | ||
name_path_tag=subprocess.run(["git","describe","--tags"],capture_output=True, text=True).stdout.split('*') | ||
name_path_branch = name_path_branch[1].split()[0] | ||
name_path_branch=subprocess.run(["git","branch"],capture_output=True, text=True).stdout | ||
os.chdir(directory) | ||
if default_tag not in name_path_tag and name_path_branch != branch: | ||
stop_report = f"Tag and branch of prexisting directory {diretory}/{name} does not match fre --version or branch requested" | ||
|
@@ -51,14 +52,14 @@ def _checkoutTemplate(experiment, platform, target, branch='empty'): | |
else: | ||
if os.path.isdir(name): #scenario 3 | ||
os.chdir(name) | ||
name_path_tag=subprocess.run(["git","describe","--tags"],capture_output=True, text=True).stdout.split() | ||
name_path_tag=subprocess.run(["git","describe","--tags"],capture_output=True, text=True).stdout.split()[0] | ||
os.chdir(directory) | ||
if not default_tag in name_path_tag: | ||
stop_report = f"Tag of prexisting directory {diretory}/{name} does not match fre --version" | ||
sys.exit(stop_report) | ||
return 1 | ||
else: #scenario 1 | ||
subprocess.run(f'git checkout tags/{default_tags}') | ||
subprocess.run(f'git clone --branch={branch} https://github.com/NOAA-GFDL/fre-cli.git') | ||
|
||
# Clone the repository with depth=1; check for errors | ||
click.echo("cloning experiment into directory " + directory + "/" + name) | ||
|
@@ -93,7 +94,7 @@ def _checkoutTemplate(experiment, platform, target, branch='empty'): | |
############################################# | ||
|
||
@click.command() | ||
def checkoutTemplate(experiment, platform, target, branch = 'empty'): | ||
def checkoutTemplate(experiment, platform, target, branch = None): | ||
''' | ||
Wrapper script for calling checkoutTemplate - allows the decorated version | ||
of the function to be separate from the undecorated version | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The tag retrieved from
fre --version
has a one digit month but the fre-workflows (and fre-cli) tags are two-digit month. So thisc2b:~%>fre --version
fre-cli | 2024.1
needs to be expanded to
2024.01
to be used as a tag for fre-workflows.