Ran update-copyright.
[update-copyright.git] / update_copyright / vcs / mercurial.py
index d71ce9c15d8a33de6a3ed2a14c1db0d0e1a28b5c..b2810b2314be45327cba2ee302836a00a8b63785 100644 (file)
@@ -1,4 +1,19 @@
-# Copyright
+# 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 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/>.
 
 from __future__ import absolute_import
 
@@ -17,7 +32,10 @@ from . import utils as _utils
 class MercurialBackend (_VCSBackend):
     name = 'Mercurial'
 
-    @staticmethod
+    def __init__(self, **kwargs):
+        super(MercurialBackend, self).__init__(**kwargs)
+        self._version = _version
+
     def _hg_cmd(*args):
         cwd = _os.getcwd()
         stdout = _sys.stdout
@@ -26,6 +44,7 @@ class MercurialBackend (_VCSBackend):
         tmp_stderr = _StringIO.StringIO()
         _sys.stdout = tmp_stdout
         _sys.stderr = tmp_stderr
+        _os.chdir(self._root)
         try:
             _mercurial_dispatch.dispatch(list(args))
         finally:
@@ -35,10 +54,6 @@ class MercurialBackend (_VCSBackend):
         return (tmp_stdout.getvalue().rstrip('\n'),
                 tmp_stderr.getvalue().rstrip('\n'))
 
-    def __init__(self, **kwargs):
-        super(MercurialBackend, self).__init__(**kwargs)
-        self._version = _version
-
     def _years(self, filename=None):
         args = [
             '--template', '{date|shortdate}\n',