Skip to content

Commit

Permalink
Merge pull request #196 from johnpaulalex/readmod
Browse files Browse the repository at this point in the history
Remove printlog from read_gitmodules_file 

...since read_externals_description_file() already has a nearly-the-same printlog (but add it to the other caller).

Also mark it private (leading underscore) because it is not called from outside the module.

User interface changes?: No

Fixes: None

Testing:
test removed: none
unit tests: none
system tests: reran python -m unittest test.test_sys_checkout.TestSubrepoCheckout.test_submodule_checkout_bare, which had the duplicate printlog behavior.
manual testing:
  • Loading branch information
billsacks authored Mar 3, 2023
2 parents 5d13719 + 932a749 commit a04f114
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions manic/externals_description.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def read_externals_description_file(root_dir, file_name):

externals_description = None
if file_name == ExternalsDescription.GIT_SUBMODULES_FILENAME:
externals_description = read_gitmodules_file(root_dir, file_name)
externals_description = _read_gitmodules_file(root_dir, file_name)
else:
try:
config = config_parser()
Expand Down Expand Up @@ -191,7 +191,7 @@ def parse_submodules_desc_section(section_items, file_path):

return path, url

def read_gitmodules_file(root_dir, file_name):
def _read_gitmodules_file(root_dir, file_name):
# pylint: disable=deprecated-method
# Disabling this check because the method is only used for python2
# pylint: disable=too-many-locals
Expand All @@ -203,12 +203,11 @@ def read_gitmodules_file(root_dir, file_name):
root_dir = os.path.abspath(root_dir)
msg = 'In directory : {0}'.format(root_dir)
logging.info(msg)
printlog('Processing submodules description file : {0}'.format(file_name))

file_path = os.path.join(root_dir, file_name)
if not os.path.exists(file_name):
msg = ('ERROR: submodules description file, "{0}", does not '
'exist at path:\n {1}'.format(file_name, file_path))
'exist in dir:\n {1}'.format(file_name, root_dir))
fatal_error(msg)

submodules_description = None
Expand Down Expand Up @@ -640,8 +639,11 @@ def _repo_config_from_submodule(self, field, submod_desc):
' Parent repo, "{1}" does not have submodules')
fatal_error(msg.format(field, self._parent_repo.name()))

submod_file = read_gitmodules_file(repo_path, submod_file)
submod_desc = create_externals_description(submod_file)
printlog(
'Processing submodules description file : {0} ({1})'.format(
submod_file, repo_path))
submod_model_data= _read_gitmodules_file(repo_path, submod_file)
submod_desc = create_externals_description(submod_model_data)

# Can we find our external?
repo_url = None
Expand Down

0 comments on commit a04f114

Please sign in to comment.