Add vlogging to gitcheckup.

This commit is contained in:
voussoir 2021-07-24 12:51:32 -07:00
parent 3ce8b91630
commit 90fe477ad9
No known key found for this signature in database
GPG key ID: 5F7554F8C26DACCB

View file

@ -54,8 +54,11 @@ import sys
from voussoirkit import betterhelp from voussoirkit import betterhelp
from voussoirkit import dotdict from voussoirkit import dotdict
from voussoirkit import pathclass from voussoirkit import pathclass
from voussoirkit import vlogging
from voussoirkit import winwhich from voussoirkit import winwhich
log = vlogging.getLogger(__name__, 'gitcheckup')
GIT = winwhich.which('git') GIT = winwhich.which('git')
# https://git-scm.com/docs/git-status#_short_format # https://git-scm.com/docs/git-status#_short_format
@ -80,6 +83,7 @@ class NoUpstreamBranch(GitCheckupException):
# HELPERS # HELPERS
################################################################################ ################################################################################
def check_output(command): def check_output(command):
log.debug(subproctools.format_command(command))
output = subprocess.check_output(command, stderr=subprocess.STDOUT) output = subprocess.check_output(command, stderr=subprocess.STDOUT)
output = output.decode().strip() output = output.decode().strip()
return output return output
@ -260,6 +264,7 @@ def gitcheckup(
do_push=False, do_push=False,
run_command=None, run_command=None,
): ):
log.debug('gitcheckup in %s', directory.absolute_path)
os.chdir(directory.absolute_path) os.chdir(directory.absolute_path)
if run_command: if run_command:
@ -332,6 +337,7 @@ def gitcheckup_argparse(args):
sys.stdout.write(exc.output.decode()) sys.stdout.write(exc.output.decode())
return 1 return 1
@vlogging.main_decorator
def main(argv): def main(argv):
parser = argparse.ArgumentParser(description=__doc__) parser = argparse.ArgumentParser(description=__doc__)