Deleted function third_complete_metadata_review() because forth_complete_metadata_review() is the same. Also, modified a substring of their name from complete to submit and submit to save for clarity. Usually submission is the last step of a review process.
This commit is contained in:
@ -87,7 +87,7 @@ def first_initialize_metadata_review(hdf5_file_path, reviewer_attrs):
|
|||||||
current_branch_command = ['git','branch','--show-current']
|
current_branch_command = ['git','branch','--show-current']
|
||||||
curr_branch = subprocess.run(current_branch_command,capture_output=True,text=True,check=True)
|
curr_branch = subprocess.run(current_branch_command,capture_output=True,text=True,check=True)
|
||||||
if not branch_name in curr_branch.stdout:
|
if not branch_name in curr_branch.stdout:
|
||||||
raise ValueError("Please checkout the branch: "+branch_name+" via Git Bash Terminal while in the project's directory")
|
raise ValueError("Branch "+branch_name+" was not found. \nPlease open a Git Bash Terminal, and follow the below instructions: \n1. Change directory to your project's directory. \n2. Excecute the command: git checkout "+branch_name)
|
||||||
|
|
||||||
# Check if review file already exists and then check if it is still untracked
|
# Check if review file already exists and then check if it is still untracked
|
||||||
review_yaml_file_path = os.path.join("review/",filename+YAML_EXT)
|
review_yaml_file_path = os.path.join("review/",filename+YAML_EXT)
|
||||||
@ -142,7 +142,7 @@ def first_initialize_metadata_review(hdf5_file_path, reviewer_attrs):
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
def second_submit_metadata_review(review_yaml_file_path, reviewer_attrs):
|
def second_save_metadata_review(review_yaml_file_path, reviewer_attrs):
|
||||||
"""
|
"""
|
||||||
Once you're done reviewing the yaml representation of hdf5 file in review folder.
|
Once you're done reviewing the yaml representation of hdf5 file in review folder.
|
||||||
Change the review status to complete and save (add and commit) modified .yalm and .txt files in the project by
|
Change the review status to complete and save (add and commit) modified .yalm and .txt files in the project by
|
||||||
@ -193,37 +193,6 @@ def second_submit_metadata_review(review_yaml_file_path, reviewer_attrs):
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
def third_complete_metadata_review(reviewer_attrs):
|
|
||||||
|
|
||||||
|
|
||||||
initials = reviewer_attrs['initials']
|
|
||||||
|
|
||||||
push_command = lambda repository,refspec: ['git','push',repository,refspec]
|
|
||||||
list_branches_command = ['git','branch','--list']
|
|
||||||
|
|
||||||
repository = 'origin'
|
|
||||||
branch_name = '-'.join([reviewer_attrs['type'],'review','by',initials])
|
|
||||||
|
|
||||||
branches = subprocess.run(list_branches_command,capture_output=True,text=True,check=True)
|
|
||||||
if not branch_name in branches.stdout:
|
|
||||||
print('There is no branch named '+branch_name+'.\n')
|
|
||||||
print('Make sure to run metadata reviewer workflow from the beginning without missing any steps.')
|
|
||||||
return
|
|
||||||
|
|
||||||
current_branch_command = ['git','branch','--show-current']
|
|
||||||
curr_branch = subprocess.run(current_branch_command,capture_output=True,text=True,check=True)
|
|
||||||
|
|
||||||
if not branch_name in curr_branch.stdout:
|
|
||||||
print('Complete metadata review could not be completed.\n')
|
|
||||||
print('Make sure a metadata-reviewer workflow has already been started on branch '+branch_name+'\n')
|
|
||||||
print('The step "Complete metadata review" will have no effect.')
|
|
||||||
return
|
|
||||||
|
|
||||||
result = subprocess.run(push_command(repository,branch_name),capture_output=True,check=True)
|
|
||||||
|
|
||||||
print(result.stdout)
|
|
||||||
|
|
||||||
return result.returncode
|
|
||||||
|
|
||||||
def third_update_hdf5_file_with_review(input_hdf5_file, yalm_review_file, reviewer_attrs = {}):
|
def third_update_hdf5_file_with_review(input_hdf5_file, yalm_review_file, reviewer_attrs = {}):
|
||||||
|
|
||||||
@ -331,13 +300,14 @@ def third_update_hdf5_file_with_review(input_hdf5_file, yalm_review_file, review
|
|||||||
# print(exc)
|
# print(exc)
|
||||||
|
|
||||||
|
|
||||||
def fourth_complete_metadata_review(reviewer_attrs):
|
def fourth_submit_metadata_review(reviewer_attrs):
|
||||||
|
|
||||||
initials =reviewer_attrs['initials']
|
initials =reviewer_attrs['initials']
|
||||||
|
|
||||||
repository = 'origin'
|
repository = 'origin'
|
||||||
branch_name = '-'.join([reviewer_attrs['type'],'review','by',initials])
|
branch_name = '-'.join([reviewer_attrs['type'],'review','by',initials])
|
||||||
|
|
||||||
|
push_command = lambda repository,refspec: ['git','push',repository,refspec]
|
||||||
current_branch_command = ['git','branch','--show-current']
|
current_branch_command = ['git','branch','--show-current']
|
||||||
list_branches_command = ['git','branch','--list']
|
list_branches_command = ['git','branch','--list']
|
||||||
|
|
||||||
@ -354,7 +324,7 @@ def fourth_complete_metadata_review(reviewer_attrs):
|
|||||||
print('The step "Complete metadata review" will have no effect.')
|
print('The step "Complete metadata review" will have no effect.')
|
||||||
return
|
return
|
||||||
|
|
||||||
push_command = lambda repository,refspec: ['git','push',repository,refspec]
|
|
||||||
|
|
||||||
# push
|
# push
|
||||||
result = subprocess.run(push_command(repository,branch_name),capture_output=True,text=True,check=True)
|
result = subprocess.run(push_command(repository,branch_name),capture_output=True,text=True,check=True)
|
||||||
@ -365,7 +335,7 @@ def fourth_complete_metadata_review(reviewer_attrs):
|
|||||||
#shutil.rmtree(os.path.join(os.path.abspath(os.curdir),"review"))
|
#shutil.rmtree(os.path.join(os.path.abspath(os.curdir),"review"))
|
||||||
# 3. git rm review/
|
# 3. git rm review/
|
||||||
# 4. git commit -m "Completed review process. Current state of hdf5 file and yml should be up to date."
|
# 4. git commit -m "Completed review process. Current state of hdf5 file and yml should be up to date."
|
||||||
return True
|
return result.returncode
|
||||||
|
|
||||||
|
|
||||||
#import config_file
|
#import config_file
|
||||||
|
Reference in New Issue
Block a user