Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
repo: https://github.com/jacebrowning/gitman-demo
rev: example-branch
- name: gitman_2
type: git
repo: https://github.com/jacebrowning/gitman-demo
rev: example-branch
groups:
- name: gitman_1
members:
- gitman_1
- gitman_2
"""
)
config.datafile.load()
with pytest.raises(InvalidConfig):
gitman.update(depth=1, lock=True)
exit_message = None
try:
log.debug("Running %s command...", getattr(function, '__name__', 'a'))
success = function(*args, **kwargs)
except KeyboardInterrupt:
log.debug("Command canceled")
except exceptions.UncommittedChanges as exception:
_show_error(exception)
exit_message = (
"Run again with --force/--force-interactive to discard changes "
"or '--skip-changes' to skip this dependency"
)
except exceptions.ScriptFailure as exception:
_show_error(exception)
exit_message = "Run again with '--force' to ignore script errors"
except exceptions.InvalidConfig as exception:
_show_error(exception)
exit_message = "Adapt config and run again"
finally:
if exit_message:
common.show(exit_message, color='message')
common.newline()
if success:
log.debug("Command succeeded")
else:
log.debug("Command failed")
sys.exit(1)
def _on_post_load(self):
for source in self.sources:
source._on_post_load() # pylint: disable=protected-access
for source in self.sources_locked:
source._on_post_load() # pylint: disable=protected-access
# check for conflicts between source names and group names
for source in self.sources:
for group in self.groups:
if source.name == group.name:
msg = (
"Name conflict detected between source name and "
"group name \"{}\""
).format(source.name)
raise exceptions.InvalidConfig(msg)
sparse_paths=None,
):
super().__init__()
self.type = type or 'git'
self.repo = repo
self.name = self._infer_name(repo) if name is None else name
self.rev = rev
self.link = link
self.scripts = scripts or []
self.sparse_paths = sparse_paths or []
for key in ['name', 'repo', 'rev']:
if not self[key]:
msg = "'{}' required for {}".format(key, repr(self))
raise exceptions.InvalidConfig(msg)
def __init__(self, name, members):
super().__init__()
self.name = name
self.members = members or []
for key in ['name', 'members']:
if not self[key]:
msg = "'{}' required for {}".format(key, repr(self))
raise exceptions.InvalidConfig(msg)