From 76de9b464901102c8f7267d6d634559fa3535626 Mon Sep 17 00:00:00 2001 From: Lakshmi Vyasarajan Date: Sun, 13 Mar 2011 16:02:38 +0530 Subject: [PATCH] Added dvcs publisher --- hyde/ext/publishers/dvcs.py | 44 +++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 hyde/ext/publishers/dvcs.py diff --git a/hyde/ext/publishers/dvcs.py b/hyde/ext/publishers/dvcs.py new file mode 100644 index 0000000..f0c43ab --- /dev/null +++ b/hyde/ext/publishers/dvcs.py @@ -0,0 +1,44 @@ +import sys +import abc + +from hyde.loader import load_python_object + +class DVCS(object): + __metaclass__ = abc.ABCMeta + + def __init__(self, path, settings): + self.path = path + self.url = settings.url + self.branch = settings.branch + self.switch(self.branch) + self.settings = settings + + @abc.abstractmethod + def save_draft(self, message=None): pass + + @abc.abstractmethod + def publish(self): pass + + @abc.abstractmethod + def pull(self): pass + + @abc.abstractmethod + def push(self, branch): pass + + @abc.abstractmethod + def commit(self, message): pass + + @abc.abstractmethod + def switch(self, branch): pass + + @abc.abstractmethod + def add_file(self, path, message=None): pass + + @abc.abstractmethod + def merge(self, branch): pass + + @staticmethod + def load_dvcs(path, settings): + repo_class = load_python_object(settings['type']) + return repo_class(path, repo) +