mirror of
https://github.com/facebook/sapling.git
synced 2024-10-10 08:47:12 +03:00
git_handler.load_map: avoid split and strip
For a mapfile with 1.5 million entries, this speeds up load_map from 2.3 seconds to 1.8.
This commit is contained in:
parent
6e87e0e982
commit
1a15adc3e0
@ -173,7 +173,13 @@ class GitHandler(object):
|
||||
map_hg_real = {}
|
||||
if os.path.exists(self.repo.join(self.map_file)):
|
||||
for line in self.repo.opener(self.map_file):
|
||||
gitsha, hgsha = line.strip().split(' ', 1)
|
||||
# format is <40 hex digits> <40 hex digits>\n
|
||||
if len(line) != 82:
|
||||
raise ValueError(
|
||||
_('corrupt mapfile: incorrect line length %d') %
|
||||
len(line))
|
||||
gitsha = line[:40]
|
||||
hgsha = line[41:81]
|
||||
map_git_real[gitsha] = hgsha
|
||||
map_hg_real[hgsha] = gitsha
|
||||
self._map_git_real = map_git_real
|
||||
|
Loading…
Reference in New Issue
Block a user