summaryrefslogtreecommitdiffstats
path: root/GitAutoDeploy.py
diff options
context:
space:
mode:
authorchivorotkiv <shmakov@omich.net>2015-05-02 08:42:01 +0600
committerchivorotkiv <shmakov@omich.net>2015-05-02 08:42:01 +0600
commitee1eab544524da42caf7186c1de30d3506da0a76 (patch)
tree98ef6d1016d3c3ecb0cb1a7a40b9a38a662c5506 /GitAutoDeploy.py
parent1d528cb237354103c26e8b12bce5af6c947b8595 (diff)
downloadGit-Auto-Deploy-ee1eab544524da42caf7186c1de30d3506da0a76.zip
Git-Auto-Deploy-ee1eab544524da42caf7186c1de30d3506da0a76.tar.gz
Git-Auto-Deploy-ee1eab544524da42caf7186c1de30d3506da0a76.tar.bz2
Configure branch name in config file
Diffstat (limited to 'GitAutoDeploy.py')
-rwxr-xr-xGitAutoDeploy.py17
1 files changed, 10 insertions, 7 deletions
diff --git a/GitAutoDeploy.py b/GitAutoDeploy.py
index bae734d..d58037b 100755
--- a/GitAutoDeploy.py
+++ b/GitAutoDeploy.py
@@ -45,10 +45,10 @@ class GitAutoDeploy(BaseHTTPRequestHandler):
def do_process(self, urls):
for url in urls:
- paths = self.getMatchingPaths(url)
- for path in paths:
- self.pull(path)
- self.deploy(path)
+ repos = self.getMatchingPaths(url)
+ for repo in repos:
+ self.pull(repo['path'], repo['branch'])
+ self.deploy(repo['path'])
def parseRequest(self):
contenttype = self.headers.getheader('content-type')
@@ -100,7 +100,10 @@ class GitAutoDeploy(BaseHTTPRequestHandler):
config = self.getConfig()
for repository in config['repositories']:
if(repository['url'] == repoUrl):
- res.append(repository['path'])
+ res.append({
+ 'path': repository['path'],
+ 'branch': (repository['branch'] or 'master')
+ })
return res
def respond(self):
@@ -108,11 +111,11 @@ class GitAutoDeploy(BaseHTTPRequestHandler):
self.send_header('Content-type', 'text/plain')
self.end_headers()
- def pull(self, path):
+ def pull(self, path, branch):
if(not self.quiet):
print "\nPost push request received"
print 'Updating ' + path
- call(['cd "' + path + '" && git fetch origin ; git update-index --refresh &> /dev/null ; git reset --hard origin/master'], shell=True)
+ call(['cd "' + path + '" && git fetch origin ; git update-index --refresh &> /dev/null ; git reset --hard origin/' + branch], shell=True)
def deploy(self, path):
config = self.getConfig()