# Path: moa/sysConf.py
# USERCONFIGFILE = os.path.join(os.path.expanduser('~'),
#                               '.config', 'moa', 'config')
# SYSCONFIGFILE = os.path.join('etc', 'moa', 'config')
# def _interpret_var(v):
#     def __init__(self):
#     def getUser(self):
#     def saveUser(self, conf):
#     def getVersion(self):
# class SysConf(Yaco.Yaco):


import glob
import os
import subprocess as sp
import sys
import time
import tempfile
import moa.args
import moa.logger
import moa.api
from sh import git, ErrorReturnCode
from moa.sysConf import sysConf
"""
**moaGit** - maintain a git repository with job information
-----------------------------------------------------------

"""

#import git

l = moa.logger.getLogger(__name__)
l.setLevel(moa.logger.DEBUG)


ACTIVE = False


def _exit_need_git_repo():
    moa.ui.exitError("Enforcing git use - please initialze a git rep")

@moa.api.api
def git_check_repo():
    """
    Check if this directory is inside a git repo

    return False if not, returns the git root if true
    """

    try:
        gitdir = git('rev-parse', git_dir=True).strip()
    except ErrorReturnCode:
        #no git repo here.

# Path: moa/sysConf.py
# USERCONFIGFILE = os.path.join(os.path.expanduser('~'),
#                               '.config', 'moa', 'config')
# SYSCONFIGFILE = os.path.join('etc', 'moa', 'config')
# def _interpret_var(v):
#     def __init__(self):
#     def getUser(self):
#     def saveUser(self, conf):
#     def getVersion(self):
# class SysConf(Yaco.Yaco):


# Path: moa/plugin/system/moaGit.py
import glob
import os
import subprocess as sp
import sys
import time
import tempfile
import moa.args
import moa.logger
import moa.api
from sh import git, ErrorReturnCode
from moa.sysConf import sysConf

"""
**moaGit** - maintain a git repository with job information
-----------------------------------------------------------

"""

#import git

l = moa.logger.getLogger(__name__)
l.setLevel(moa.logger.DEBUG)


ACTIVE = False


def _exit_need_git_repo():
    moa.ui.exitError("Enforcing git use - please initialze a git rep")

@moa.api.api
def git_check_repo():
    """
    Check if this directory is inside a git repo

    return False if not, returns the git root if true
    """

    try:
        gitdir = git('rev-parse', git_dir=True).strip()
    except ErrorReturnCode:
        #no git repo here.

        if sysConf.plugins.system.moaGit.enforce: