Skip to content

Commit

Permalink
Squashed 'manage_externals/' changes from a465b4f..60fc03b
Browse files Browse the repository at this point in the history
60fc03b Merge pull request #101 from ESMCI/catch_svn_error
28073ec add exception class
4fb7e47 catch errors from svn status --xml
bfa4831 Merge pull request #98 from billsacks/quieter
7d12650 make style
afb4f11 Make more git and svn commands quieter

git-subtree-dir: manage_externals
git-subtree-split: 60fc03b
  • Loading branch information
jedwards4b committed May 7, 2018
1 parent 9b08185 commit ad97463
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 11 deletions.
8 changes: 5 additions & 3 deletions manic/checkout.py
Original file line number Diff line number Diff line change
Expand Up @@ -320,12 +320,14 @@ def main(args):

root_dir = os.path.abspath(os.getcwd())
external_data = read_externals_description_file(root_dir, args.externals)
external = create_externals_description(external_data, components=args.components)
external = create_externals_description(
external_data, components=args.components)

for comp in args.components:
if comp not in external.keys():
fatal_error("No component {} found in {}".format(comp, args.externals))

fatal_error(
"No component {} found in {}".format(
comp, args.externals))

source_tree = SourceTree(root_dir, external)
printlog('Checking status of externals: ', end='')
Expand Down
9 changes: 6 additions & 3 deletions manic/externals_description.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,16 +91,19 @@ def read_externals_description_file(root_dir, file_name):
return externals_description


def create_externals_description(model_data, model_format='cfg', components=None):
def create_externals_description(
model_data, model_format='cfg', components=None):
"""Create the a externals description object from the provided data
"""
externals_description = None
if model_format == 'dict':
externals_description = ExternalsDescriptionDict(model_data, components=components)
externals_description = ExternalsDescriptionDict(
model_data, components=components)
elif model_format == 'cfg':
major, _, _ = get_cfg_schema_version(model_data)
if major == 1:
externals_description = ExternalsDescriptionConfigV1(model_data, components=components)
externals_description = ExternalsDescriptionConfigV1(
model_data, components=components)
else:
msg = ('Externals description file has unsupported schema '
'version "{0}".'.format(major))
Expand Down
6 changes: 3 additions & 3 deletions manic/repository_git.py
Original file line number Diff line number Diff line change
Expand Up @@ -694,7 +694,7 @@ def _git_remote_verbose():
def _git_clone(url, repo_dir_name, verbosity):
"""Run git clone for the side effect of creating a repository.
"""
cmd = ['git', 'clone', url, repo_dir_name]
cmd = ['git', 'clone', '--quiet', url, repo_dir_name]
if verbosity >= VERBOSITY_VERBOSE:
printlog(' {0}'.format(' '.join(cmd)))
execute_subprocess(cmd)
Expand All @@ -710,7 +710,7 @@ def _git_remote_add(name, url):
def _git_fetch(remote_name):
"""Run the git fetch command to for the side effect of updating the repo
"""
cmd = ['git', 'fetch', '--tags', remote_name]
cmd = ['git', 'fetch', '--quiet', '--tags', remote_name]
execute_subprocess(cmd)

@staticmethod
Expand All @@ -721,7 +721,7 @@ def _git_checkout_ref(ref, verbosity):
form 'origin/my_feature', or 'tag1'.
"""
cmd = ['git', 'checkout', ref]
cmd = ['git', 'checkout', '--quiet', ref]
if verbosity >= VERBOSITY_VERBOSE:
printlog(' {0}'.format(' '.join(cmd)))
execute_subprocess(cmd)
7 changes: 5 additions & 2 deletions manic/repository_svn.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,10 @@ def xml_status_is_dirty(svn_output):
# pylint: enable=invalid-name

is_dirty = False
xml_status = ET.fromstring(svn_output)
try:
xml_status = ET.fromstring(svn_output)
except BaseException:
fatal_error("SVN returned invalid XML message {}".format(svn_output))
xml_target = xml_status.find('./target')
entries = xml_target.findall('./entry')
for entry in entries:
Expand Down Expand Up @@ -270,7 +273,7 @@ def _svn_switch(url, verbosity):
"""
Switch branches for in an svn sandbox
"""
cmd = ['svn', 'switch', url]
cmd = ['svn', 'switch', '--quiet', url]
if verbosity >= VERBOSITY_VERBOSE:
printlog(' {0}'.format(' '.join(cmd)))
execute_subprocess(cmd)

0 comments on commit ad97463

Please sign in to comment.