diff --git a/svn/local.py b/svn/local.py index 686063b..ffb6497 100644 --- a/svn/local.py +++ b/svn/local.py @@ -116,3 +116,29 @@ def remove(self, rel_path, do_keep_local=False, do_force=False): self.run_command( 'rm', args) + + def lock(self, rel_filepaths=[], do_force=False): + args = [] + + if do_force is True: + args.append('--force') + + args += rel_filepaths + + self.run_command( + 'lock', + args, + wd=self.path) + + def unlock(self, rel_filepaths=[], do_force=False): + args = [] + + if do_force is True: + args.append('--force') + + args += rel_filepaths + + self.run_command( + 'unlock', + args, + wd=self.path) diff --git a/svn/resources/README.md b/svn/resources/README.md index d8b6aad..1eb338e 100644 --- a/svn/resources/README.md +++ b/svn/resources/README.md @@ -25,6 +25,8 @@ Functions currently implemented: - update - cleanup - remove (i.e. rm, del, delete) +- lock +- unlock In addition, there is also an "admin" class (`svn.admin.Admin`) that provides a `create` method with which to create repositories. diff --git a/tests/test_local.py b/tests/test_local.py index 445f4b8..68db5a3 100644 --- a/tests/test_local.py +++ b/tests/test_local.py @@ -87,3 +87,10 @@ def test_cleanup(self): with svn.test_support.temp_repo(): with svn.test_support.temp_checkout() as (_, lc): lc.cleanup() + + def test_lock(self): + with svn.test_support.temp_repo(): + with svn.test_support.temp_checkout() as (_, lc): + svn.test_support.populate_bigger_file_changes1() + lc.lock(['committed_unchanged']) + lc.unlock(['committed_unchanged'])