I'm using Jenkins with python code as follows.
After detecting a change to the GIT dev branch:

Checkout GIT repository dev branch code
Perform Unit tests / code coverage
If build passes, check code into the production branch of the same repo

What I want to add, is the ability to keep track of the previous code version (the python code package stores the version number in the setup.py file ) and if the version in the latest build job is incremented compared to the saved version, only then check the passed code into the production branch.
Any thoughts on how best to achieve this?
Thanks
I've made use of the following plugins to achieve this:

Flexible Publish Plugin
Run Condition Plugin
Jenkins - Store code previous version number, and take actions if version number changes