forked from bmun/huxley
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfabfile.py
56 lines (41 loc) · 1.68 KB
/
fabfile.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# Copyright (c) 2011-2013 Kunal Mehta. All rights reserved.
# Use of this source code is governed by a BSD License found in README.md.
from fabric.api import run, local
from fabric.contrib.console import confirm
def update(remote='upstream'):
print "Updating your local branch..."
local('git fetch %s' % remote);
local('git rebase %s/master' % remote)
def feature(branch_name=''):
if not branch_name:
print "No branch name given. Usage: fab feature:<branch_name>"
return
local('git checkout -tb %s' % branch_name)
update()
def submit():
update()
_push_to_remote_topic_branch()
print "Push to remote branch successful. Go to github.com to issue a pull request."
def revise():
_push_to_remote_topic_branch()
def finish():
branch_name = local('git rev-parse --abbrev-ref HEAD', capture=True)
if branch_name == 'master':
print "On branch master. You probably don't want to do this."
return
if not confirm("This will delete your local and remote topic branch. "
"Make sure your pull request has been merged or closed. "
"Are you sure you want to finish this branch?"):
print "Aborting."
return
print "Deleting remote branch..."
local('git push origin :%s' % branch_name)
print "Deleting local branch..."
local('git checkout master')
local('git branch -D %s' % branch_name)
def _push_to_remote_topic_branch():
print "Pushing to remote topic branch..."
branch_name = local('git rev-parse --abbrev-ref HEAD', capture=True)
local('git push origin %s' % branch_name)
def static():
local('python manage.py collectstatic --noinput')