20 util as interfaceutil, |
18 util as interfaceutil, |
21 ) |
19 ) |
22 |
20 |
23 from . import gitutil |
21 from . import gitutil |
24 |
22 |
|
23 pygit2 = gitutil.get_pygit2() |
|
24 |
25 |
25 |
26 def readpatternfile(orig, filepath, warn, sourceinfo=False): |
26 def readpatternfile(orig, filepath, warn, sourceinfo=False): |
27 if not (b'info/exclude' in filepath or filepath.endswith(b'.gitignore')): |
27 if not (b'info/exclude' in filepath or filepath.endswith(b'.gitignore')): |
28 return orig(filepath, warn, sourceinfo=False) |
28 return orig(filepath, warn, sourceinfo=False) |
29 result = [] |
29 result = [] |
44 |
44 |
45 |
45 |
46 extensions.wrapfunction(matchmod, b'readpatternfile', readpatternfile) |
46 extensions.wrapfunction(matchmod, b'readpatternfile', readpatternfile) |
47 |
47 |
48 |
48 |
49 _STATUS_MAP = { |
49 _STATUS_MAP = {} |
50 pygit2.GIT_STATUS_CONFLICTED: b'm', |
50 if pygit2: |
51 pygit2.GIT_STATUS_CURRENT: b'n', |
51 _STATUS_MAP = { |
52 pygit2.GIT_STATUS_IGNORED: b'?', |
52 pygit2.GIT_STATUS_CONFLICTED: b'm', |
53 pygit2.GIT_STATUS_INDEX_DELETED: b'r', |
53 pygit2.GIT_STATUS_CURRENT: b'n', |
54 pygit2.GIT_STATUS_INDEX_MODIFIED: b'n', |
54 pygit2.GIT_STATUS_IGNORED: b'?', |
55 pygit2.GIT_STATUS_INDEX_NEW: b'a', |
55 pygit2.GIT_STATUS_INDEX_DELETED: b'r', |
56 pygit2.GIT_STATUS_INDEX_RENAMED: b'a', |
56 pygit2.GIT_STATUS_INDEX_MODIFIED: b'n', |
57 pygit2.GIT_STATUS_INDEX_TYPECHANGE: b'n', |
57 pygit2.GIT_STATUS_INDEX_NEW: b'a', |
58 pygit2.GIT_STATUS_WT_DELETED: b'r', |
58 pygit2.GIT_STATUS_INDEX_RENAMED: b'a', |
59 pygit2.GIT_STATUS_WT_MODIFIED: b'n', |
59 pygit2.GIT_STATUS_INDEX_TYPECHANGE: b'n', |
60 pygit2.GIT_STATUS_WT_NEW: b'?', |
60 pygit2.GIT_STATUS_WT_DELETED: b'r', |
61 pygit2.GIT_STATUS_WT_RENAMED: b'a', |
61 pygit2.GIT_STATUS_WT_MODIFIED: b'n', |
62 pygit2.GIT_STATUS_WT_TYPECHANGE: b'n', |
62 pygit2.GIT_STATUS_WT_NEW: b'?', |
63 pygit2.GIT_STATUS_WT_UNREADABLE: b'?', |
63 pygit2.GIT_STATUS_WT_RENAMED: b'a', |
64 pygit2.GIT_STATUS_INDEX_MODIFIED | pygit2.GIT_STATUS_WT_MODIFIED: 'm', |
64 pygit2.GIT_STATUS_WT_TYPECHANGE: b'n', |
65 } |
65 pygit2.GIT_STATUS_WT_UNREADABLE: b'?', |
|
66 pygit2.GIT_STATUS_INDEX_MODIFIED | pygit2.GIT_STATUS_WT_MODIFIED: 'm', |
|
67 } |
66 |
68 |
67 |
69 |
68 @interfaceutil.implementer(intdirstate.idirstate) |
70 @interfaceutil.implementer(intdirstate.idirstate) |
69 class gitdirstate(object): |
71 class gitdirstate(object): |
70 def __init__(self, ui, root, gitrepo): |
72 def __init__(self, ui, root, gitrepo): |