Ran update-copyright.
[update-copyright.git] / update_copyright / vcs / git.py
index 65411fe2e3db6de2a6f9a87ada428b4890e8dbbc..9a4f567b962f2c610802777ce9c2974588126de1 100644 (file)
@@ -1,20 +1,19 @@
-# Copyright (C) 2012 W. Trevor King
+# Copyright (C) 2012 W. Trevor King <wking@tremily.us>
 #
 # This file is part of update-copyright.
 #
-# update-copyright is free software: you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation, either version 3 of the
-# License, or (at your option) any later version.
+# update-copyright is free software: you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the Free
+# Software Foundation, either version 3 of the License, or (at your option) any
+# later version.
 #
-# update-copyright is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-# General Public License for more details.
+# update-copyright is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+# more details.
 #
-# You should have received a copy of the GNU General Public License
-# along with update-copyright.  If not, see
-# <http://www.gnu.org/licenses/>.
+# You should have received a copy of the GNU General Public License along with
+# update-copyright.  If not, see <http://www.gnu.org/licenses/>.
 
 from . import VCSBackend as _VCSBackend
 from . import utils as _utils
@@ -42,14 +41,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(date.split('-', 1)[0]) for date in dates)
         return years
 
     def _authors(self, filename=None):