Make sure we are really updating the mercurial repository

This fixes a bug where if you have any changes pushed to a mercurial repo no matter which revision you specify the state will claim the repository is updated. This also correctly detects when you switch from one branch to another in mercurial even if there are no new changes being pulled.
This commit is contained in:
Daniel Hobley 2016-03-03 08:48:00 +01:00
parent 36c790eede
commit ca41c4b8c1

View file

@ -116,7 +116,7 @@ def _update_repo(ret, name, target, clean, user, identity, rev, opts):
'"hg pull && hg up is probably required"'.format(target)
)
current_rev = __salt__['hg.revision'](target, user=user)
current_rev = __salt__['hg.revision'](target, user=user, rev='.')
if not current_rev:
return _fail(
ret,
@ -137,7 +137,7 @@ def _update_repo(ret, name, target, clean, user, identity, rev, opts):
else:
__salt__['hg.update'](target, 'tip', force=clean, user=user)
new_rev = __salt__['hg.revision'](cwd=target, user=user)
new_rev = __salt__['hg.revision'](cwd=target, user=user, rev='.')
if current_rev != new_rev:
revision_text = '{0} => {1}'.format(current_rev, new_rev)