-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #237 from GEOS-ESM/develop
GitFlow: Merge Develop into Main for release
- Loading branch information
Showing
5 changed files
with
84 additions
and
5 deletions.
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
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
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 |
---|---|---|
@@ -0,0 +1,51 @@ | ||
from state.state import MepoState | ||
from utilities import colors | ||
from utilities import verify | ||
from utilities.version import version_to_string, sanitize_version_string | ||
from repository.git import GitRepository | ||
from shutil import get_terminal_size | ||
from state.component import MepoVersion | ||
import os | ||
|
||
VER_LEN = 30 | ||
|
||
def run(args): | ||
allcomps = MepoState.read_state() | ||
|
||
if any_differing_repos(allcomps): | ||
comps2diff = _get_comps_to_diff(args.comp_name, allcomps) | ||
|
||
for comp in comps2diff: | ||
git = GitRepository(comp.remote, comp.local) | ||
orig_ver = version_to_string(comp.version,git).split()[1] | ||
orig_type = comp.version.type | ||
changed_files = git.get_changed_files(untracked=True, orig_ver=orig_ver, comp_type=orig_type) | ||
|
||
# If there are changed files, print them with the local path | ||
if changed_files: | ||
for file in changed_files: | ||
if args.full_path: | ||
print(os.path.abspath(os.path.join(comp.local, file))) | ||
else: | ||
print(os.path.join(comp.local, file)) | ||
|
||
def _get_comps_to_diff(specified_comps, allcomps): | ||
comps_to_diff = allcomps | ||
if specified_comps: | ||
verify.valid_components(specified_comps, allcomps) | ||
comps_to_diff = [x for x in allcomps if x.name in specified_comps] | ||
return comps_to_diff | ||
|
||
def any_differing_repos(allcomps): | ||
for comp in allcomps: | ||
git = GitRepository(comp.remote, comp.local) | ||
curr_ver = version_to_string(git.get_version(),git) | ||
orig_ver = version_to_string(comp.version,git) | ||
|
||
# This command is to try and work with git tag oddities | ||
curr_ver = sanitize_version_string(orig_ver,curr_ver,git) | ||
|
||
if curr_ver not in orig_ver: | ||
return True | ||
|
||
return False |
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
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