doorstop.core.vcs.subversion   A
last analyzed

Complexity

Total Complexity 8

Size/Duplication

Total Lines 46
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 8
eloc 30
dl 0
loc 46
rs 10
c 0
b 0
f 0
ccs 20
cts 20
cp 1

6 Methods

Rating   Name   Duplication   Size   Complexity  
A WorkingCopy.add() 0 2 1
A WorkingCopy.delete() 0 2 1
A WorkingCopy.lock() 0 3 1
A WorkingCopy.edit() 0 2 1
A WorkingCopy.commit() 0 3 1
A WorkingCopy.ignores() 0 10 3
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