Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Refactoring for version control uploader, add SVN uploader

  • Loading branch information...
commit 57a376a52efa972d1785f796827306957907a97a 1 parent 5391dde
@kachayev authored
Showing with 33 additions and 3 deletions.
  1. +33 −3 src/uploader.py
View
36 src/uploader.py
@@ -106,10 +106,16 @@ def __init__(self, source, dest):
def get(self):
shutil.move(self.source, self.destination)
-class GitUploader(RemoveTreeRollback):
+class VersionControl(RemoveTreeRollback):
'''
- Upload library source files with using system call of Git utilites
+ Upload library source files with using system call
+ of some version control utilities
'''
+ COMMANDS = {
+ 'get': None,
+ 'update': None
+ }
+
repo = None
destination = None
@@ -118,9 +124,33 @@ def __init__(self, repo, dest):
self.destination = dest
def get(self):
- os.system('git clone %s %s' % (self.repo, self.destination))
+ os.system(self._command('get') % (self.repo, self.destination))
+
+ def _command(self, type):
+ if self.COMMANDS[type] is None:
+ raise UploadingFailed('Undefined version control command called')
+
+ return self.COMMANDS[type]
+class GitUploader(VersionControl):
+ '''
+ Upload library source files with using system call GIT utilities
+ '''
+ COMMANDS = {
+ 'get': 'git clone %s %s',
+ 'update': None
+ }
+
+class SvnUploader(VersionControl):
+ '''
+ Upload library source files with using system call SVN utilities
+ '''
+ COMMANDS = {
+ 'get': 'svn checkout %s %s',
+ 'update': None
+ }
+
class UploadingFailed(Exception):
pass
Please sign in to comment.
Something went wrong with that request. Please try again.