doorstop.core.vcs.subversion.WorkingCopy.edit()   A
last analyzed

Complexity

Conditions 1

Size

Total Lines 2
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 1
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 2
dl 0
loc 2
ccs 1
cts 1
cp 1
rs 10
c 0
b 0
f 0
cc 1
nop 2
crap 1
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