From: W. Trevor King Date: Wed, 14 Mar 2012 11:38:24 +0000 (-0400) Subject: Split out _dates from _years in GitBackend. X-Git-Tag: v0.4~7 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=294725f82ef1bee8a42f6bc7161ebcfd9a57040f;p=update-copyright.git Split out _dates from _years in GitBackend. This makes it easier for external modules to use the GitBackend to do different things with the extracted list of dates. --- diff --git a/update_copyright/vcs/git.py b/update_copyright/vcs/git.py index 65411fe..fd6b85f 100644 --- a/update_copyright/vcs/git.py +++ b/update_copyright/vcs/git.py @@ -42,14 +42,18 @@ class GitBackend (_VCSBackend): ['git'] + list(args), cwd=self._root, unicode_output=True) return stdout.rstrip('\n') - def _years(self, filename=None): + def _dates(self, filename=None): args = ['log'] + self._year_format if filename is not None: args.extend(['--follow'] + [filename]) output = self._git_cmd(*args) if self._version.startswith('1.5.'): output = '\n'.join([x.split()[0] for x in output.splitlines()]) - years = set(int(line.split('-', 1)[0]) for line in output.splitlines()) + return output.splitlines() + + def _years(self, filename=None): + dates = self._dates(filename=filename) + years = set(int(line.split('-', 1)[0]) for date in dates) return years def _authors(self, filename=None):