Total Complexity | 8 |
Total Lines | 46 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 0 |
1 | # SPDX-License-Identifier: LGPL-3.0-only |
||
2 | |||
3 | 1 | """Plug-in module to store requirements in a Subversion (1.7) repository.""" |
|
4 | |||
5 | 1 | import os |
|
6 | 1 | ||
7 | from doorstop import common |
||
8 | 1 | from doorstop.core.vcs.base import BaseWorkingCopy |
|
9 | |||
10 | log = common.logger(__name__) |
||
11 | 1 | ||
12 | |||
13 | class WorkingCopy(BaseWorkingCopy): |
||
14 | 1 | """Subversion working copy.""" |
|
15 | 1 | ||
16 | DIRECTORY = '.svn' |
||
17 | 1 | IGNORES = ('.sgignores', '.vvignores') |
|
18 | 1 | ||
19 | 1 | def lock(self, path): |
|
20 | self.call('svn', 'update') |
||
21 | 1 | self.call('svn', 'lock', path) |
|
22 | 1 | ||
23 | def edit(self, path): |
||
24 | 1 | log.debug("`svn` adds all changes") |
|
25 | 1 | ||
26 | def add(self, path): |
||
27 | 1 | self.call('svn', 'add', path) |
|
28 | 1 | ||
29 | def delete(self, path): |
||
30 | 1 | self.call('svn', 'delete', path) |
|
31 | 1 | ||
32 | 1 | def commit(self, message=None): |
|
33 | message = message or input("Commit message: ") |
||
34 | 1 | self.call('svn', 'commit', '--message', message) |
|
35 | |||
36 | @property |
||
37 | def ignores(self): |
||
38 | if self._ignores_cache is None: |
||
39 | self._ignores_cache = [] |
||
40 | os.chdir(self.path) |
||
41 | for line in self.call( |
||
42 | 'svn', 'pg', '-R', 'svn:ignore', '.', return_stdout=True |
||
43 | ).splitlines(): |
||
44 | self._ignores_cache.append(line) |
||
45 | return self._ignores_cache |
||
46 |