From ef48008bbc7e641edb2f4f304f749d5378c3de2e Mon Sep 17 00:00:00 2001 From: Vye Wilson Date: Tue, 25 Feb 2014 14:41:52 -0800 Subject: [PATCH] added explicit git revision support to winrepo --- salt/modules/win_repo.py | 5 +++++ salt/runners/winrepo.py | 5 +++++ salt/states/git.py | 2 +- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/salt/modules/win_repo.py b/salt/modules/win_repo.py index 328d5ade3e..5fe1777ecd 100644 --- a/salt/modules/win_repo.py +++ b/salt/modules/win_repo.py @@ -105,9 +105,14 @@ def update_git_repos(): #else: #targetname = gitrepo targetname = gitrepo + rev = None + # If a revision is specified, use it. + if len(gitrepo.strip().split(' ')) > 1: + rev, gitrepo = gitrepo.strip().split(' ') gittarget = os.path.join(repo, targetname) #result = mminion.states['git.latest'](gitrepo, result = __salt__['git.latest'](gitrepo, + rev=rev, target=gittarget, force=True) ret[result['name']] = result['result'] diff --git a/salt/runners/winrepo.py b/salt/runners/winrepo.py index 8b7a780678..09650a3a5b 100644 --- a/salt/runners/winrepo.py +++ b/salt/runners/winrepo.py @@ -91,8 +91,13 @@ def update_git_repos(): targetname = gitrepo.split('/')[-1] else: targetname = gitrepo + rev = None + # If a revision is specified, use it. + if len(gitrepo.strip().split(' ')) > 1: + rev, gitrepo = gitrepo.strip().split(' ') gittarget = os.path.join(repo, targetname) result = mminion.states['git.latest'](gitrepo, + rev=rev, target=gittarget, force=True) ret[result['name']] = result['result'] diff --git a/salt/states/git.py b/salt/states/git.py index 8da78ec012..b27be56246 100644 --- a/salt/states/git.py +++ b/salt/states/git.py @@ -213,7 +213,7 @@ def latest(name, identity=identity) elif rev: - cmd = 'git rev-parse {0} ^{{commit}}'.format(rev) + cmd = 'git rev-parse {0}'.format(rev) retcode = __salt__['cmd.retcode'](cmd, cwd=target, runas=user)