comparison hgext/convert/git.py @ 25698:307370c2dda2

convert: handle .gitmodules with non-tab whitespaces The old implementation assumed .gitmodules file lines always began with tabs. It can be any whitespace, so lets trim the lines appropriately.
author Durham Goode <durham@fb.com>
date Mon, 29 Jun 2015 17:19:18 -0700
parents 216fa1ba9993
children 5c97a4ecbdd4
comparison
equal deleted inserted replaced
25697:1538e72209fd 25698:307370c2dda2
172 \tpath = sub\n 172 \tpath = sub\n
173 \turl = git://giturl\n 173 \turl = git://giturl\n
174 """ 174 """
175 self.submodules = [] 175 self.submodules = []
176 c = config.config() 176 c = config.config()
177 # Each item in .gitmodules starts with \t that cant be parsed 177 # Each item in .gitmodules starts with whitespace that cant be parsed
178 c.parse('.gitmodules', content.replace('\t','')) 178 c.parse('.gitmodules', '\n'.join(line.strip() for line in
179 content.split('\n')))
179 for sec in c.sections(): 180 for sec in c.sections():
180 s = c[sec] 181 s = c[sec]
181 if 'url' in s and 'path' in s: 182 if 'url' in s and 'path' in s:
182 self.submodules.append(submodule(s['path'], '', s['url'])) 183 self.submodules.append(submodule(s['path'], '', s['url']))
183 184