1
from quickly import configurationhandler
4
class revisionsystem(object):
6
if not configurationhandler.project_config:
7
configurationhandler.loadConfig()
8
if not configurationhandler.global_config:
9
configurationhandler.loadConfig(get_global=True)
11
revision_system = configurationhandler.global_config.get('revision_system', 'bzr')
12
print ">>", revision_system
13
revision_system = configurationhandler.project_config.get('revision_system', revision_system)
14
print ">>", revision_system
15
self.handler = handlers[revision_system]()
18
def commit(self, comment):
19
self.handler.commit(comment)
20
def add_files(self, files=None):
21
self.handler.add_files(files)
22
def tag(self, comment):
24
def get_files_to_ignore(self):
25
self.handler.get_files_to_ignore()
27
class vcs_base_handler(object):
28
def __init__(self, binary):
31
subprocess.call([self.binary, "init"])
34
def commit(self,comment):
35
subprocess.call([self.binary, "commit", "-m", comment])
37
def add_files(self, files=None):
39
subprocess.call([self.binary, "add"])
41
subprocess.call([self.binary, "add"] + files)
43
def tag(self, comment):
44
subprocess.call([self.binary, "tag", comment])
46
def get_files_to_ignore(self):
47
return ["."+self.binary]
49
class bzr_handler(vcs_base_handler):
51
super(bzr_handler, self).__init__("bzr")
53
class hg_handler(vcs_base_handler):
55
super(hg_handler, self).__init__("hg")
57
class svn_handler(object):
59
raise NotImplementedError
62
# subprocess.call(["hg", "init"])
65
def commit(self,comment):
66
subprocess.call(["svn", "commit", "-m", comment])
68
def add_files(self, files):
70
files = subprocess.call(["svn", "add"])
72
subprocess.call(["svn", "add"] + files)
74
def tag(self, comment):
75
subprocess.call(["svn", "tag", comment])
77
def get_files_to_ignore(self):