Scrapy, a fast high-level web crawling & scraping framework for Python.
scrapy deploy support git version
Julien Duponchelleb7c436343a77
diff --git a/docs/topics/scrapyd.rst b/docs/topics/scrapyd.rstindex 0804b831e..8803e70fe 100644--- a/docs/topics/scrapyd.rst+++ b/docs/topics/scrapyd.rst@@ -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 everydiff --git a/scrapy/commands/deploy.py b/scrapy/commands/deploy.pyindex 46c67902f..7f2fe62a7 100644--- a/scrapy/commands/deploy.py+++ b/scrapy/commands/deploy.py@@ -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 versionelse: