# Path: vcs/exceptions.py
# class VCSError(Exception):
#     pass
# 
# Path: vcs/exceptions.py
# class RepositoryError(VCSError):
#     pass
# 
# Path: vcs/utils/paths.py
# def get_dirs_for_path(*paths):
# def get_dir_size(path):
# def get_user_home():


import re
import os
import time
import datetime
    import logging
        import pygments
from subprocess import Popen, PIPE
from vcs.exceptions import VCSError
from vcs.exceptions import RepositoryError
from vcs.utils.paths import abspath
    from vcs.backends import get_backend
    from pygments import highlight
    from pygments.lexers import guess_lexer_for_filename, ClassNotFound
    from pygments.formatters import TerminalFormatter
    shortcuts given in ``ALIASES``) and top working dir path for the given
    argument. If no scm-specific directory is found or more than one scm is
    found at that directory, ``VCSError`` is raised.

    :param search_up: if set to ``True``, this function would try to
      move up to parent directory every time no scm is recognized for the
      currently checked path. Default: ``False``.
    :param explicit_alias: can be one of available backend aliases, when given
      it will return given explicit alias in repositories under more than one
      version control, if explicit_alias is different than found it will raise
      VCSError
    """
    if not os.path.isdir(path):
        raise VCSError("Given path %s is not a directory" % path)

    def get_scms(path):
        return [(scm, path) for scm in get_scms_for_path(path)]

    found_scms = get_scms(path)
    while not found_scms and search_up:
        newpath = abspath(path, '..')
        if newpath == path:
            break
        path = newpath
        found_scms = get_scms(path)

    if len(found_scms) > 1:
        for scm in found_scms:
            if scm[0] == explicit_alias:
                return scm

# Path: vcs/exceptions.py
# class VCSError(Exception):
#     pass
# 
# Path: vcs/exceptions.py
# class RepositoryError(VCSError):
#     pass
# 
# Path: vcs/utils/paths.py
# def get_dirs_for_path(*paths):
# def get_dir_size(path):
# def get_user_home():


# Path: vcs/utils/helpers.py
import re
import os
import time
import datetime
    import logging
        import pygments
from subprocess import Popen, PIPE
from vcs.exceptions import VCSError
from vcs.exceptions import RepositoryError
from vcs.utils.paths import abspath
    from vcs.backends import get_backend
    from pygments import highlight
    from pygments.lexers import guess_lexer_for_filename, ClassNotFound
    from pygments.formatters import TerminalFormatter

    shortcuts given in ``ALIASES``) and top working dir path for the given
    argument. If no scm-specific directory is found or more than one scm is
    found at that directory, ``VCSError`` is raised.

    :param search_up: if set to ``True``, this function would try to
      move up to parent directory every time no scm is recognized for the
      currently checked path. Default: ``False``.
    :param explicit_alias: can be one of available backend aliases, when given
      it will return given explicit alias in repositories under more than one
      version control, if explicit_alias is different than found it will raise
      VCSError
    """
    if not os.path.isdir(path):
        raise VCSError("Given path %s is not a directory" % path)

    def get_scms(path):
        return [(scm, path) for scm in get_scms_for_path(path)]

    found_scms = get_scms(path)
    while not found_scms and search_up:
        newpath = abspath(path, '..')
        if newpath == path:
            break
        path = newpath
        found_scms = get_scms(path)

    if len(found_scms) > 1:
        for scm in found_scms:
            if scm[0] == explicit_alias:
                return scm

        raise VCSError('More than one [%s] scm found at given path %s'