From 294725f82ef1bee8a42f6bc7161ebcfd9a57040f Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Wed, 14 Mar 2012 07:38:24 -0400 Subject: [PATCH] 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. --- update_copyright/vcs/git.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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): -- 2.26.2