Commits

Vladimir Mihailenco committed 9f80231 Merge

Merge with git support

Comments (0)

Files changed (2)

fab_deploy/utils.py

 
     defaults = _AttributeDict(
         HG_BRANCH = 'default',
+        GIT_BRANCH = 'master',
         DB_NAME = env.conf['INSTANCE_NAME'],
         DB_USER = 'root',
         PROCESSES = 1,
     defaults.update(env.conf)
     env.conf = defaults
 
-    for vcs in ['hg', 'none']: # expand VCS name to full import path
+    for vcs in ['git', 'hg', 'none']: # expand VCS name to full import path
         if env.conf.VCS == vcs:
             env.conf.VCS = 'fab_deploy.vcs.'+vcs
 

fab_deploy/vcs/git.py

+from fabric.api import *
+from fab_deploy.utils import upload_config_template
+
+BRANCH_OPTION = 'GIT_BRANCH'
+
+def init():
+    run('git init')
+    run('git config receive.denyCurrentBranch ignore') # allow update current branch
+
+def up(branch):
+    run('git checkout --force %s' % branch) # overwrite local changes
+
+def push():
+    user, host = env.hosts[0].split('@')
+    local('git push ssh://%s/~%s/src/%s/ %s' % (env.hosts[0], user, env.conf.INSTANCE_NAME,
+                                             env.conf.GIT_BRANCH))
+
+def configure():
+    pass