Add _git_command that executes a command at the repo's path
authorGuido Günther <agx@sigxcpu.org>
Fri, 21 Oct 2011 19:04:29 +0000 (21:04 +0200)
committerGuido Günther <agx@sigxcpu.org>
Fri, 21 Oct 2011 19:11:01 +0000 (21:11 +0200)
making explicit path checking superfluous.

Git-Dch: Ignore

gbp/git.py

index c51f420..19f63bc 100644 (file)
@@ -78,6 +78,17 @@ class GitRepository(object):
         (stdout, stderr) = popen.communicate(input)
         return stdout, stderr, popen.returncode
 
+    def _git_command(self, command, args=[], extra_env=None):
+        """
+        Execute git command with arguments args and environment env
+        at path.
+
+        @param command: git command
+        @param args: command line arguments
+        @extra_env: extra environment variables to set when running command
+        """
+        GitCommand(command, args, extra_env=extra_env, cwd=self.path)()
+
     def base_dir(self):
         """Base of the repository"""
         return os.path.join(self.path, '.git')