scrapy deploy support git version

This commit is contained in:
Julien Duponchelle 2011-09-21 22:17:08 +02:00
parent b003687389
commit b7c436343a
2 changed files with 9 additions and 0 deletions

View File

@ -313,6 +313,12 @@ revision, for example ``r382``::
scrapy deploy scrapyd -p project1 --version HG
Also, if you use Git for tracking your project source code, you can use
``GIT`` for the version which will be replaced by the SHA1 of current Git
revision, for example ``b0582849179d1de7bd86eaa7201ea3cda4b5651f``::
scrapy deploy scrapyd -p project1 --version GIT
Support for other version discovery sources may be added in the future.
Finally, if you don't want to specify the target, project and version every

View File

@ -150,6 +150,9 @@ def _get_version(target, opts):
if version == 'HG':
p = Popen(['hg', 'tip', '--template', '{rev}'], stdout=PIPE)
return 'r%s' % p.communicate()[0]
elif version == 'GIT':
p = Popen(['git', 'rev-parse', 'HEAD'], stdout=PIPE)
return '%s' % p.communicate()[0].strip('\n')
elif version:
return version
else: