ansible/ansible — pull request #694 by sfromm (2012-07-26 07:31:42+00:00)
Title: Update git module to handle branches better

I'll be out for a few days. If there is a problem with this commit or the git module, I can tackle it then. When I get back, I can switch the git module over to module-magic if someone hasn't done so already. This is intended to fix #688. Commit message below.

This drops the branch option. The version option is overloaded
to mean either a sha1, branch, or tag. This also adds the option
'remote' which defaults to 'origin'.
clone() was simplified by removing the checkout operation. That
happens later when switch_version() is called.

Added the methods get_branches(), is_remote_branch(), and
is_local_branch(). get_branches() returns an array listing all
of the branches for the git repository. is_remote_branch() checks
whether the arguments supplied correspond to a remote branch.
Similarly, is_local_branch() checks for a local branch.

The pull() method now checks to see if it is on the desired branch.
If not, it checks out the requested branch and then does a pull.
This should keep issue #604 still fixed.

switch_version(), formerly switchver(), looks to see if it is
checking out a branch. If a branch, it checks it out with the --track
option. This type of checkout was in pull() before.

Updated pull, clone, and switch_version to return (rc, out, err).