# Path: ellen/utils/git.py
# PYGIT2_OBJ_TYPE = {
#     GIT_OBJ_COMMIT: 'commit',
#     GIT_OBJ_BLOB: 'blob',
#     GIT_OBJ_TREE: 'tree',
#     GIT_OBJ_TAG: 'tag',
# }
# 
# Path: ellen/utils/text.py
# def trunc_utf8(string, num, etc="..."):
#     """truncate a utf-8 string, show as num chars.
#     arg: string, a utf-8 encoding string; num, look like num chars
#     return: a utf-8 string
#     """
#     try:
#         gb = string.decode("utf8", "ignore")
#     except UnicodeEncodeError:  # Already decoded
#         gb = string
#     gb = gb.encode("gb18030", "ignore")
#     if num >= len(gb):
#         return string
#     if etc:
#         etc_len = len(etc.decode("utf8", "ignore").encode("gb18030", "ignore"))
#         trunc_idx = num - etc_len
#     else:
#         trunc_idx = num
#     ret = gb[:trunc_idx].decode("gb18030", "ignore").encode("utf8")
#     if etc:
#         ret += etc
#     return ret


import re
import sys
import mime
import magic
from datetime import datetime
from ellen.utils.git import PYGIT2_OBJ_TYPE
from ellen.utils.text import trunc_utf8
    from pygit2 import GIT_MERGE_ANALYSIS_FASTFORWARD, GIT_MERGE_ANALYSIS_UP_TO_DATE
#!/usr/bin/env python
# -*- coding: utf-8 -*-




# from ellen.utils.text import highlight_code # no use yet

m = magic._get_magic_type(True)
magic.magic_setflags(m.cookie,
                     magic.MAGIC_NONE |
                     magic.MAGIC_NO_CHECK_COMPRESS |
                     magic.MAGIC_NO_CHECK_TAR |

# Path: ellen/utils/git.py
# PYGIT2_OBJ_TYPE = {
#     GIT_OBJ_COMMIT: 'commit',
#     GIT_OBJ_BLOB: 'blob',
#     GIT_OBJ_TREE: 'tree',
#     GIT_OBJ_TAG: 'tag',
# }
# 
# Path: ellen/utils/text.py
# def trunc_utf8(string, num, etc="..."):
#     """truncate a utf-8 string, show as num chars.
#     arg: string, a utf-8 encoding string; num, look like num chars
#     return: a utf-8 string
#     """
#     try:
#         gb = string.decode("utf8", "ignore")
#     except UnicodeEncodeError:  # Already decoded
#         gb = string
#     gb = gb.encode("gb18030", "ignore")
#     if num >= len(gb):
#         return string
#     if etc:
#         etc_len = len(etc.decode("utf8", "ignore").encode("gb18030", "ignore"))
#         trunc_idx = num - etc_len
#     else:
#         trunc_idx = num
#     ret = gb[:trunc_idx].decode("gb18030", "ignore").encode("utf8")
#     if etc:
#         ret += etc
#     return ret


# Path: ellen/utils/format.py
import re
import sys
import mime
import magic
from datetime import datetime
from ellen.utils.git import PYGIT2_OBJ_TYPE
from ellen.utils.text import trunc_utf8
    from pygit2 import GIT_MERGE_ANALYSIS_FASTFORWARD, GIT_MERGE_ANALYSIS_UP_TO_DATE

#!/usr/bin/env python
# -*- coding: utf-8 -*-




# from ellen.utils.text import highlight_code # no use yet

m = magic._get_magic_type(True)
magic.magic_setflags(m.cookie,
                     magic.MAGIC_NONE |
                     magic.MAGIC_NO_CHECK_COMPRESS |
                     magic.MAGIC_NO_CHECK_TAR |

                     magic.MAGIC_NO_CHECK_SOFT |