salimfadhley/jenkinsapi — pull request #250 by toumorokoshi (2014-03-05 07:52:05+00:00)
Title: get_revision raises error when querying a job with no SCM

Hello,

When you use the "get_revision" method on a job with no scm, an IndexError is thrown. This seems to result from get_revision assuming git in the case that no scm is parsed from the _data object, and also the fact that _get_git_rev always to return the latest result.

It seems like the right behavior here should be to return None. This change fixes that, as well as adds a test that illustrates the behavior I ran into.

I want to note that i thought a better idea would be to change it in the "get_revision" method and not default to git, but that could potentially change behavior that users rely on, so I opted to change as little behavior as possible.