# The following settings define the VCS choices for the system.
# They are separated in basic and additional options below.

# BASIC VCS OPTIONS

# To be ignored by the get_files method
IGNORE_WILDCARD_LIST = "(.*/.bzr/.*)|(.*/.hg/.*)|(.*/.git/.*)|(.*/.svn/.*)|" \
                       "(.*/CVS/.*)|(.*/CVSROOT/.*)|(.*/\..*ignore.*)"

# List of codebase types. Also feeds the Unit model with the available options.
CODEBASE_CHOICES = {'hg': 'Mercurial',}

# Directories where checked-out units will be put. The final location of
# a unit will be something like: SCRATCH_DIR/sources/hg/unit_slug.
REPO_PATHS = {'hg': os.path.join(SCRATCH_DIR, 'sources', 'hg'),}

# The classes which implement the VCS support.
BROWSER_CLASS_NAMES = {'hg': 'vcs.lib.types.hg.HgBrowser',}

# TODO: Think about a better way to handle it
# List of submission types supported by the codebase.
SUBMISSION_VCS_TYPES = {
                        'email': 'Maintainers\' email', 
                        # This key should be probably renamed to 'repo', but it
                        # will require a data migration in the database. 
                        'ssh': 'The upstream repository directly '
                       }
SUBMISSION_CHOICES = {'hg': SUBMISSION_VCS_TYPES,}

# This setting identifies if the CODEBASES support branches or not
BRANCH_SUPPORT = {'hg': False}

# Default user information for commits
# Used only in backends which support it
COMMITTER_NAME = 'Transifex robot'
COMMITTER_EMAIL = DEFAULT_FROM_EMAIL

# Default submit message format for centralized VCSs. Backends can override
# this.
CVCS_SUBMIT_MSG = """%(date)s  %(userinfo)s

%(message)s"""

# Default submit message format for decentralized VCSs. Backends can override
# this.
DVCS_SUBMIT_MSG = """l10n: %(message)s

New status: %(status)s.

Transmitted-via: Transifex (%(domain)s)."""

# Username/email template to use for submissions
VCS_USER_TEMPLATE = (u'{% if user.user %}'
    '{% if user.firstname %}'
        '{{ user.firstname }} {{ user.surname }} <{{ user.user.email }}>'
    '{% else %}'
        '{{ user.user }} <{{ user.user.email }}>'
    '{% endif %}'
'{% else %}'
    '{% if user.firstname %}'
        '{{ user.firstname }} {{ user.surname }} <{{ user.email }}>'
    '{% else %}'
        '{{ user.username }} <{{ user.email }}>'
    '{% endif %}'
'{% endif %}'
    )

# Allowed prefixes for the repository root URLs. This will limit the URLs a user
# can define. It can help you disallow access to repositories on the system
# itself (ones starting with /), non-standard protocols etc.
# The 'all' setting is also allowed for each type  on top of its setting.
ALLOWED_REPOSITORY_PREFIXES = {'all' : ['ssh://', 'https://', 'http://'],
                               'hg'  : [],}

# Additional repository prefixes to allow when running the server in DEBUG mode.
# Example: ['/', 'file://']
ALLOWED_REPOSITORY_PREFIXES_DEBUG = ['/', 'file://']

if DEBUG:
    ALLOWED_REPOSITORY_PREFIXES['all'].extend(ALLOWED_REPOSITORY_PREFIXES_DEBUG)

