-# 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
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
tmp_stderr = _StringIO.StringIO()
_sys.stdout = tmp_stdout
_sys.stderr = tmp_stderr
+ _os.chdir(self._root)
try:
_mercurial_dispatch.dispatch(list(args))
finally:
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',