| Total Complexity | 5 |
| Total Lines | 34 |
| Duplicated Lines | 67.65 % |
| Coverage | 100% |
| Changes | 0 | ||
Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.
Common duplication problems, and corresponding solutions are:
| 1 | # SPDX-License-Identifier: LGPL-3.0-only |
||
| 2 | |||
| 3 | 1 | """Plug-in module to store requirements in a Mercurial repository.""" |
|
| 4 | 1 | ||
| 5 | from doorstop import common |
||
| 6 | 1 | from doorstop.core.vcs.base import BaseWorkingCopy |
|
| 7 | |||
| 8 | log = common.logger(__name__) |
||
| 9 | 1 | ||
| 10 | |||
| 11 | View Code Duplication | class WorkingCopy(BaseWorkingCopy): |
|
|
|
|||
| 12 | 1 | """Mercurial working copy.""" |
|
| 13 | 1 | ||
| 14 | DIRECTORY = '.hg' |
||
| 15 | 1 | IGNORES = ('.hgignore',) |
|
| 16 | 1 | ||
| 17 | 1 | def lock(self, path): |
|
| 18 | log.debug("`hg` does not support locking: {}".format(path)) |
||
| 19 | 1 | self.call('hg', 'pull', '-u') |
|
| 20 | 1 | ||
| 21 | def edit(self, path): |
||
| 22 | 1 | self.call('hg', 'add', path) |
|
| 23 | 1 | ||
| 24 | def add(self, path): |
||
| 25 | 1 | self.call('hg', 'add', path) |
|
| 26 | 1 | ||
| 27 | def delete(self, path): |
||
| 28 | 1 | self.call('hg', 'remove', path, '--force') |
|
| 29 | 1 | ||
| 30 | 1 | def commit(self, message=None): |
|
| 31 | 1 | message = message or input("Commit message: ") |
|
| 32 | self.call('hg', 'commit', '--message', message) |
||
| 33 | self.call('hg', 'push') |
||
| 34 |