Skip to content

Commit

Permalink
Added add, commit, and update to LC. Can now send WD to command.
Browse files Browse the repository at this point in the history
  • Loading branch information
dsoprea committed Oct 18, 2016
1 parent cf1260f commit c0b0c17
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
3 changes: 2 additions & 1 deletion svn/common_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

class CommonBase(object):
def external_command(self, cmd, success_code=0, do_combine=False,
return_binary=False, environment={}):
return_binary=False, environment={}, wd=None):
_LOGGER.debug("RUN: %s" % (cmd,))

env = os.environ.copy()
Expand All @@ -21,6 +21,7 @@ def external_command(self, cmd, success_code=0, do_combine=False,
cmd,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
cwd=wd,
env=env)

stdout = p.stdout.read()
Expand Down
21 changes: 20 additions & 1 deletion svn/local.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@


class LocalClient(svn.common.CommonClient):

def __init__(self, path_, *args, **kwargs):
if os.path.exists(path_) is False:
raise EnvironmentError("Path does not exist: %s" % path_)
Expand All @@ -17,3 +16,23 @@ def __init__(self, path_, *args, **kwargs):

def __repr__(self):
return '<SVN(LOCAL) %s>' % self.path

def add(self, rel_path):
self.run_command(
'add',
[rel_path],
wd=self.path)

def commit(self, message, rel_filepaths=[]):
args = ['-m', message] + rel_filepaths

self.run_command(
'commit',
args,
wd=self.path)

def update(self, rel_filepaths=[]):
self.run_command(
'update',
rel_filepaths,
wd=self.path)

0 comments on commit c0b0c17

Please sign in to comment.