We use the configured VCS for the author list and per-file updates, so
there's nothing we can do if the user hasn't set it. Instead of
crashing with:
Traceback (most recent call last):
File "./bin/update-copyright.py", line 80, in <module>
project.update_authors(dry_run=args.dry_run)
File "/.../update_copyright/project.py", line 162, in update_authors
authors = self._vcs.authors()
AttributeError: 'NoneType' object has no attribute 'authors'
Die earlier with:
Traceback (most recent call last):
File "./bin/update-copyright.py", line 78, in <module>
project.load_config(open(args.config, 'r'))
File "/home/wking/src/update-copyright/update_copyright/project.py", line 66, in load_config
loader(parser=parser)
File "/home/wking/src/update-copyright/update_copyright/project.py", line 89, in _load_project_conf
raise NotImplementedError('vcs: {}'.format(vcs))
NotImplementedError: vcs: None
We may want to add some auto-detection logic here in the future.
project = {}
self._name = project.get('name')
vcs = project.get('vcs')
project = {}
self._name = project.get('name')
vcs = project.get('vcs')
- if vcs:
- kwargs = {
- 'root': self._root,
- 'author_hacks': self._author_hacks,
- 'year_hacks': self._year_hacks,
- 'aliases': self._aliases,
- }
- if vcs == 'Git':
- self._vcs = _GitBackend(**kwargs)
- elif vcs == 'Mercurial':
- if _MercurialBackend is None:
- raise _mercurial_import_error
- self._vcs = _MercurialBackend(**kwargs)
- else:
- raise NotImplementedError('vcs: {}'.format(vcs))
+ kwargs = {
+ 'root': self._root,
+ 'author_hacks': self._author_hacks,
+ 'year_hacks': self._year_hacks,
+ 'aliases': self._aliases,
+ }
+ if vcs == 'Git':
+ self._vcs = _GitBackend(**kwargs)
+ elif vcs == 'Mercurial':
+ if _MercurialBackend is None:
+ raise _mercurial_import_error
+ self._vcs = _MercurialBackend(**kwargs)
+ else:
+ raise NotImplementedError('vcs: {}'.format(vcs))
def _load_copyright_conf(self, parser):
try:
def _load_copyright_conf(self, parser):
try: