Go back to the original branch after pylint check
Go back to the original branch after pylint check

Previously we save the current commit hash before running lintstack.
This is no problem for Jenkins but not very friendly if we run
lintstack locally. Every time after it's done, git is in detached
HEAD mode. This patch remembers the current branch name and
automatically go back to the branch if available. Otherwise we fall
back to the commit hash.

Part of blueprint lintstack

Change-Id: I145df3027022fc9a8302bc6da9ab300f677f3386

ruslanloman/nova,klmitch/nova,projectcalico/calico-nova,j-carpentier/nova,scripnichenko/nova,dawnpower/nova,whitepages/nova,shahar-stratoscale/nova,watonyweng/nova,edulramirez/nova,tudorvio/nova,vmturbo/nova,devendermishrajio/nova,Metaswitch/calico-nova,mahak/nova,TwinkleChawla/nova,mahak/nova,orbitfp7/nova,yosshy/nova,takeshineshiro/nova,ntt-sic/nova,rickerc/nova_audit,vladikr/nova_drafts,sridevikoushik31/nova,NeCTAR-RC/nova,belmiromoreira/nova,isyippee/nova,Triv90/Nova,blueboxgroup/nova,Francis-Liu/animated-broccoli,BeyondTheClouds/nova,tanglei528/nova,citrix-openstack-build/nova,LoHChina/nova,spring-week-topos/nova-week,DirectXMan12/nova-hacking,Tehsmash/nova,rajalokan/nova,mikalstill/nova,CCI-MOC/nova,rahulunair/nova,maelnor/nova,zaina/nova,cernops/nova,jianghuaw/nova,JioCloud/nova_test_latest,alvarolopez/nova,leilihh/nova,berrange/nova,silenceli/nova,affo/nova,bigswitch/nova,devendermishrajio/nova_test_latest,alaski/nova,petrutlucian94/nova_dev,CloudServer/nova,gspilio/nova,tanglei528/nova,plumgrid/plumgrid-nova,gooddata/openstack-nova,sebrandon1/nova,Yuriy-Leonov/nova,isyippee/nova,dims/nova,sridevikoushik31/nova,TwinkleChawla/nova,gooddata/openstack-nova,jeffrey4l/nova,BeyondTheClouds/nova,belmiromoreira/nova,zhimin711/nova,NeCTAR-RC/nova,felixma/nova,mgagne/nova,maelnor/nova,kimjaejoong/nova,DirectXMan12/nova-hacking,devoid/nova,plumgrid/plumgrid-nova,rajalokan/nova,virtualopensystems/nova,jianghuaw/nova,mandeepdhami/nova,maheshp/novatest,akash1808/nova,akash1808/nova_test_latest,maheshp/novatest,imsplitbit/nova,ntt-sic/nova,klmitch/nova,rahulunair/nova,redhat-openstack/nova,virtualopensystems/nova,Francis-Liu/animated-broccoli,tealover/nova,vmturbo/nova,CEG-FYP-OpenStack/scheduler,alaski/nova,Metaswitch/calico-nova,eonpatapon/nova,phenoxim/nova,j-carpentier/nova,cloudbau/nova,cloudbase/nova-virtualbox,gooddata/openstack-nova,tangfeixiong/nova,eharney/nova,TieWei/nova,affo/nova,Stavitsky/nova,cloudbase/nova,alvarolopez/nova,cloudbase/nova,projectcalico/calico-nova,tealover/nova,bgxavier/nova,yrobla/nova,OpenAcademy-OpenStack/nova-scheduler,DirectXMan12/nova-hacking,alexandrucoman/vbox-nova-driver,JioCloud/nova,sridevikoushik31/openstack,eharney/nova,cernops/nova,qwefi/nova,ted-gould/nova,devendermishrajio/nova_test_latest,hanlind/nova,zzicewind/nova,cloudbau/nova,shail2810/nova,CEG-FYP-OpenStack/scheduler,double12gzh/nova,eayunstack/nova,dawnpower/nova,hanlind/nova,jeffrey4l/nova,badock/nova,vmturbo/nova,rickerc/nova_audit,maheshp/novatest,yatinkumbhare/openstack-nova,felixma/nova,sridevikoushik31/nova,cyx1231st/nova,maoy/zknova,raildo/nova,nikesh-mahalka/nova,cloudbase/nova,jianghuaw/nova,Yusuke1987/openstack_template,sridevikoushik31/openstack,tudorvio/nova,sebrandon1/nova,openstack/nova,yatinkumbhare/openstack-nova,CCI-MOC/nova,Stavitsky/nova,mmnelemane/nova,redhat-openstack/nova,luogangyi/bcec-nova,ted-gould/nova,bgxavier/nova,MountainWei/nova,leilihh/novaha,takeshineshiro/nova,dims/nova,zaina/nova,cloudbase/nova-virtualbox,orbitfp7/nova,fnordahl/nova,qwefi/nova,watonyweng/nova,double12gzh/nova,bclau/nova,sridevikoushik31/openstack,badock/nova,joker946/nova,akash1808/nova_test_latest,raildo/nova,bigswitch/nova,Triv90/Nova,zhimin711/nova,scripnichenko/nova,Juniper/nova,akash1808/nova,varunarya10/nova_test_latest,adelina-t/nova,viggates/nova,angdraug/nova,dstroppa/openstack-smartos-nova-grizzly,Juniper/nova,SUSE-Cloud/nova,shahar-stratoscale/nova,mahak/nova,luogangyi/bcec-nova,silenceli/nova,rajalokan/nova,alexandrucoman/vbox-nova-driver,JianyuWang/nova,tianweizhang/nova,eayunstack/nova,maoy/zknova,phenoxim/nova,TieWei/nova,cernops/nova,dstroppa/openstack-smartos-nova-grizzly,thomasem/nova,SUSE-Cloud/nova,apporc/nova,tangfeixiong/nova,yrobla/nova,Yusuke1987/openstack_template,OpenAcademy-OpenStack/nova-scheduler,hanlind/nova,sridevikoushik31/nova,nikesh-mahalka/nova,petrutlucian94/nova,fnordahl/nova,klmitch/nova,MountainWei/nova,JioCloud/nova,petrutlucian94/nova_dev,ewindisch/nova,thomasem/nova,adelina-t/nova,openstack/nova,mikalstill/nova,CiscoSystems/nova,varunarya10/nova_test_latest,Brocade-OpenSource/OpenStack-DNRM-Nova,shootstar/novatest,petrutlucian94/nova,bclau/nova,edulramirez/nova,yrobla/nova,imsplitbit/nova,berrange/nova,gspilio/nova,spring-week-topos/nova-week,sacharya/nova,devendermishrajio/nova,citrix-openstack-build/nova,Triv90/Nova,leilihh/nova,maoy/zknova,shail2810/nova,Tehsmash/nova,angdraug/nova,noironetworks/nova,BeyondTheClouds/nova,Juniper/nova,saleemjaveds/https-github.com-openstack-nova,Yuriy-Leonov/nova,sebrandon1/nova,leilihh/novaha,CiscoSystems/nova,Brocade-OpenSource/OpenStack-DNRM-Nova,sacharya/nova,mandeepdhami/nova,mgagne/nova,vladikr/nova_drafts,JianyuWang/nova,mmnelemane/nova,devoid/nova,gspilio/nova,iuliat/nova,tianweizhang/nova,blueboxgroup/nova,rrader/nova-docker-plugin,barnsnake351/nova,cyx1231st/nova,eonpatapon/nova,CloudServer/nova,jianghuaw/nova,apporc/nova,LoHChina/nova,zzicewind/nova,barnsnake351/nova,noironetworks/nova,gooddata/openstack-nova,JioCloud/nova_test_latest,iuliat/nova,ewindisch/nova,mikalstill/nova,yosshy/nova,kimjaejoong/nova,rajalokan/nova,vmturbo/nova,rrader/nova-docker-plugin,ruslanloman/nova,Juniper/nova,openstack/nova,whitepages/nova,shootstar/novatest,joker946/nova,saleemjaveds/https-github.com-openstack-nova,dstroppa/openstack-smartos-nova-grizzly,klmitch/nova,rahulunair/nova,viggates/nova