Add ability to run on a remote root based on the config file.
[update-copyright.git] / update_copyright / vcs / git.py
index 46f15f13a323d68bc46b71158dab40725f16f918..65411fe2e3db6de2a6f9a87ada428b4890e8dbbc 100644 (file)
@@ -23,12 +23,6 @@ from . import utils as _utils
 class GitBackend (_VCSBackend):
     name = 'Git'
 
-    @staticmethod
-    def _git_cmd(*args):
-        status,stdout,stderr = _utils.invoke(
-            ['git'] + list(args), unicode_output=True)
-        return stdout.rstrip('\n')
-
     def __init__(self, **kwargs):
         super(GitBackend, self).__init__(**kwargs)
         self._version = self._git_cmd('--version').split(' ')[-1]
@@ -43,6 +37,11 @@ class GitBackend (_VCSBackend):
             self._year_format = ['--pretty=format:%ad',  # Author date
                                  '--date=short']         # YYYY-MM-DD
 
+    def _git_cmd(self, *args):
+        status,stdout,stderr = _utils.invoke(
+            ['git'] + list(args), cwd=self._root, unicode_output=True)
+        return stdout.rstrip('\n')
+
     def _years(self, filename=None):
         args = ['log'] + self._year_format
         if filename is not None: