Mercurial > hg-git
comparison hggit/git_handler.py @ 952:584961625a58
Backed out changeset a593069575bb
This was causing test-encoding.t to fail.
author | Siddharth Agarwal <sid0@fb.com> |
---|---|
date | Tue, 01 Dec 2015 10:19:50 -0800 |
parents | a593069575bb |
children | 528015bde034 |
comparison
equal
deleted
inserted
replaced
951:a593069575bb | 952:584961625a58 |
---|---|
17 | 17 |
18 from mercurial.i18n import _ | 18 from mercurial.i18n import _ |
19 from mercurial.node import hex, bin, nullid | 19 from mercurial.node import hex, bin, nullid |
20 from mercurial import bookmarks | 20 from mercurial import bookmarks |
21 from mercurial import commands | 21 from mercurial import commands |
22 from mercurial import encoding | |
23 from mercurial import context, util as hgutil | 22 from mercurial import context, util as hgutil |
24 from mercurial import url | 23 from mercurial import url |
25 | 24 |
26 import _ssh | 25 import _ssh |
27 import git2hg | 26 import git2hg |
134 self.load_remote_refs() | 133 self.load_remote_refs() |
135 return self._remote_refs | 134 return self._remote_refs |
136 | 135 |
137 @hgutil.propertycache | 136 @hgutil.propertycache |
138 def git(self): | 137 def git(self): |
139 # Dulwich is going to try and join unicode ref names against | |
140 # the repository path to try and read unpacked refs. This | |
141 # doesn't match hg's bytes-only view of filesystems, we just | |
142 # have to cope with that. To cope, just decode the gitdir path | |
143 # in the local encoding and say a prayer that it decodes. | |
144 gitpath = self.gitdir.decode(encoding.encoding, encoding.encodingmode) | |
145 # make the git data directory | 138 # make the git data directory |
146 if os.path.exists(self.gitdir): | 139 if os.path.exists(self.gitdir): |
147 return Repo(gitpath) | 140 return Repo(self.gitdir) |
148 else: | 141 else: |
149 os.mkdir(self.gitdir) | 142 os.mkdir(self.gitdir) |
150 return Repo.init_bare(gitpath) | 143 return Repo.init_bare(self.gitdir) |
151 | 144 |
152 def init_author_file(self): | 145 def init_author_file(self): |
153 self.author_map = {} | 146 self.author_map = {} |
154 if self.ui.config('git', 'authors'): | 147 if self.ui.config('git', 'authors'): |
155 with open(self.repo.wjoin(self.ui.config('git', 'authors'))) as f: | 148 with open(self.repo.wjoin(self.ui.config('git', 'authors'))) as f: |