Skip to content

Commit

Permalink
Merge pull request #100 from GEOS-ESM/develop
Browse files Browse the repository at this point in the history
Merge Develop into main
  • Loading branch information
mathomp4 committed Aug 26, 2020
2 parents 64fda06 + 3369caf commit b09c523
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
10 changes: 9 additions & 1 deletion mepo.d/cmdline/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,15 @@ def __diff(self):
diff = self.subparsers.add_parser(
'diff',
description = 'Diff all components')
diff.add_argument('--name-only', action = 'store_true', help = 'Show only names of changed files')
diff.add_argument(
'--name-only',
action = 'store_true',
help = 'Show only names of changed files')
diff.add_argument(
'comp_name',
metavar = 'comp-name',
nargs = '*',
help = 'Component to list branches in')

def __checkout(self):
checkout = self.subparsers.add_parser(
Expand Down
12 changes: 11 additions & 1 deletion mepo.d/command/diff/diff.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,28 @@
from state.state import MepoState
from repository.git import GitRepository
from utilities.version import version_to_string
from utilities import verify

from shutil import get_terminal_size

def run(args):
print('Diffing...'); sys.stdout.flush()

allcomps = MepoState.read_state()
comps2diff = _get_comps_to_diff(args.comp_name, allcomps)

for comp in allcomps:
for comp in comps2diff:
result = check_component_diff(comp, args)
if result:
print_diff(comp, args, result)

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 check_component_diff(comp, args):
git = GitRepository(comp.remote, comp.local)
return git.run_diff(args)
Expand Down

0 comments on commit b09c523

Please sign in to comment.