Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
ansible
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
ansible
Commits
03cb2f5f
Commit
03cb2f5f
authored
Feb 25, 2014
by
James Cammarata
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'git_version_tags' of
https://github.com/j2sol/ansible
into j2sol-git_version_tags
parents
cb799470
4593e3c3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
0 deletions
+15
-0
library/source_control/git
+15
-0
No files found.
library/source_control/git
View file @
03cb2f5f
...
...
@@ -280,6 +280,17 @@ def get_branches(git_path, module, dest):
branches
.
append
(
line
.
strip
())
return
branches
def
get_tags
(
git_path
,
module
,
dest
):
os
.
chdir
(
dest
)
tags
=
[]
cmd
=
'
%
s tag'
%
(
git_path
,)
(
rc
,
out
,
err
)
=
module
.
run_command
(
cmd
)
if
rc
!=
0
:
module
.
fail_json
(
msg
=
"Could not determine tag data - received
%
s"
%
out
)
for
line
in
out
.
split
(
'
\n
'
):
tags
.
append
(
line
.
strip
())
return
tags
def
is_remote_branch
(
git_path
,
module
,
dest
,
remote
,
version
):
cmd
=
'
%
s ls-remote
%
s -h refs/heads/
%
s'
%
(
git_path
,
remote
,
version
)
(
rc
,
out
,
err
)
=
module
.
run_command
(
cmd
,
check_rc
=
True
)
...
...
@@ -492,6 +503,10 @@ def main():
if
local_mods
:
module
.
exit_json
(
changed
=
True
,
before
=
before
,
after
=
remote_head
,
msg
=
"Local modifications exist"
)
elif
is_remote_tag
(
git_path
,
module
,
dest
,
repo
,
version
):
# if the remote is a tag and we have the tag locally, exit early
if
version
in
get_tags
(
git_path
,
module
,
dest
):
module
.
exit_json
(
changed
=
False
,
before
=
before
,
after
=
remote_head
)
else
:
module
.
exit_json
(
changed
=
False
,
before
=
before
,
after
=
remote_head
)
if
module
.
check_mode
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment