|
|
@ -268,7 +268,7 @@ from distutils.version import LooseVersion
|
|
|
|
|
|
|
|
|
|
|
|
from ansible.module_utils.basic import AnsibleModule, get_module_path
|
|
|
|
from ansible.module_utils.basic import AnsibleModule, get_module_path
|
|
|
|
from ansible.module_utils.six import b, string_types
|
|
|
|
from ansible.module_utils.six import b, string_types
|
|
|
|
from ansible.module_utils._text import to_native
|
|
|
|
from ansible.module_utils._text import to_native, to_text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def relocate_repo(module, result, repo_dir, old_repo_dir, worktree_dir):
|
|
|
|
def relocate_repo(module, result, repo_dir, old_repo_dir, worktree_dir):
|
|
|
@ -286,7 +286,7 @@ def relocate_repo(module, result, repo_dir, old_repo_dir, worktree_dir):
|
|
|
|
# if we already moved the .git dir, roll it back
|
|
|
|
# if we already moved the .git dir, roll it back
|
|
|
|
if os.path.exists(repo_dir):
|
|
|
|
if os.path.exists(repo_dir):
|
|
|
|
shutil.move(repo_dir, old_repo_dir)
|
|
|
|
shutil.move(repo_dir, old_repo_dir)
|
|
|
|
module.fail_json(msg='Unable to move git dir. %s' % str(err))
|
|
|
|
module.fail_json(msg=u'Unable to move git dir. %s' % to_text(err))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def head_splitter(headfile, remote, module=None, fail_on_error=False):
|
|
|
|
def head_splitter(headfile, remote, module=None, fail_on_error=False):
|
|
|
@ -690,7 +690,7 @@ def get_head_branch(git_path, module, dest, remote, bare=False):
|
|
|
|
module.fail_json(
|
|
|
|
module.fail_json(
|
|
|
|
msg='Current repo does not have a valid reference to a '
|
|
|
|
msg='Current repo does not have a valid reference to a '
|
|
|
|
'separate Git dir or it refers to the invalid path',
|
|
|
|
'separate Git dir or it refers to the invalid path',
|
|
|
|
details=str(err),
|
|
|
|
details=to_text(err),
|
|
|
|
)
|
|
|
|
)
|
|
|
|
# Read .git/HEAD for the name of the branch.
|
|
|
|
# Read .git/HEAD for the name of the branch.
|
|
|
|
# If we're in a detached HEAD state, look up the branch associated with
|
|
|
|
# If we're in a detached HEAD state, look up the branch associated with
|
|
|
@ -992,8 +992,8 @@ def create_archive(git_path, module, dest, archive, version, repo, result):
|
|
|
|
except OSError as e:
|
|
|
|
except OSError as e:
|
|
|
|
module.fail_json(msg="Failed to move %s to %s" %
|
|
|
|
module.fail_json(msg="Failed to move %s to %s" %
|
|
|
|
(new_archive, archive),
|
|
|
|
(new_archive, archive),
|
|
|
|
details="Error occured while moving : %s"
|
|
|
|
details=u"Error occured while moving : %s"
|
|
|
|
% to_native(e))
|
|
|
|
% to_text(e))
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
# Perform archive from local directory
|
|
|
|
# Perform archive from local directory
|
|
|
|
git_archive(git_path, module, dest, archive, archive_fmt, version)
|
|
|
|
git_archive(git_path, module, dest, archive, archive_fmt, version)
|
|
|
@ -1100,7 +1100,7 @@ def main():
|
|
|
|
module.fail_json(
|
|
|
|
module.fail_json(
|
|
|
|
msg='Current repo does not have a valid reference to a '
|
|
|
|
msg='Current repo does not have a valid reference to a '
|
|
|
|
'separate Git dir or it refers to the invalid path',
|
|
|
|
'separate Git dir or it refers to the invalid path',
|
|
|
|
details=str(err),
|
|
|
|
details=to_text(err),
|
|
|
|
)
|
|
|
|
)
|
|
|
|
gitconfig = os.path.join(repo_path, 'config')
|
|
|
|
gitconfig = os.path.join(repo_path, 'config')
|
|
|
|
|
|
|
|
|
|
|
|