Skip to content

Commit

Permalink
Make force parameter work for export operation
Browse files Browse the repository at this point in the history
The default is changed from 'yes' to 'no' to follow
subversion behavior (ie, requiring explicit confirmation
to erase a existing repository). Since that was not working before
cf ansible#370 and since the option was ignored before and unused, this
should be safe to change.
  • Loading branch information
mscherer committed Dec 13, 2014
1 parent db5668b commit ccfdff4
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions source_control/subversion.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,12 @@ def checkout(self):

def export(self, force=False):
'''Export svn repo to directory'''
self._exec(["export", "-r", self.revision, self.repo, self.dest])
cmd = ["export"]
if force:
cmd.append("--force")
cmd.extend(["-r", self.revision, self.repo, self.dest])

self._exec(cmd)

def switch(self):
'''Change working directory's repo.'''
Expand Down Expand Up @@ -173,7 +178,7 @@ def main():
dest=dict(required=True),
repo=dict(required=True, aliases=['name', 'repository']),
revision=dict(default='HEAD', aliases=['rev', 'version']),
force=dict(default='yes', type='bool'),
force=dict(default='no', type='bool'),
username=dict(required=False),
password=dict(required=False),
executable=dict(default=None),
Expand Down Expand Up @@ -202,7 +207,7 @@ def main():
if not export:
svn.checkout()
else:
svn.export()
svn.export(force=force)
elif os.path.exists("%s/.svn" % (dest, )):
# Order matters. Need to get local mods before switch to avoid false
# positives. Need to switch before revert to ensure we are reverting to
Expand Down

0 comments on commit ccfdff4

Please sign in to comment.