Skip to content

Commit

Permalink
add logging for git commands
Browse files Browse the repository at this point in the history
  • Loading branch information
vmalloc committed Jul 2, 2009
1 parent 83335e4 commit 91586d8
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions git/repository.py
Expand Up @@ -25,6 +25,7 @@
import re
import os
import subprocess
import sys

from . import branch
from . import commit
Expand All @@ -45,11 +46,20 @@

class Repository(ref_container.RefContainer):
############################# internal methods #############################
_loggingEnabled = False
def _getWorkingDirectory(self):
return '.'
def _logGitCommand(self, command, cwd):
if self._loggingEnabled:
print >> sys.stderr, ">>", command
def enableLogging(self):
self._loggingEnabled = True
def disableLogging(self):
self._loggingEnabled = False
def _executeGitCommand(self, command, cwd=None):
if cwd is None:
cwd = self._getWorkingDirectory()
self._logGitCommand(command, cwd)
returned = subprocess.Popen(command,
shell=True,
cwd=cwd,
Expand Down

0 comments on commit 91586d8

Please sign in to comment.