##// END OF EJS Templates
convert: detect removal of ".gitmodules" at git source revisions correctly...
FUJIWARA Katsunori -
r21868:34203461 stable
parent child Browse files
Show More
@@ -104,6 +104,8 b' class convert_git(converter_source):'
104 104 return data
105 105
106 106 def getfile(self, name, rev):
107 if rev == hex(nullid):
108 raise IOError
107 109 if name == '.hgsub':
108 110 data = '\n'.join([m.hgsub() for m in self.submoditer()])
109 111 mode = ''
@@ -155,6 +157,7 b' class convert_git(converter_source):'
155 157 seen = set()
156 158 entry = None
157 159 subexists = False
160 subdeleted = False
158 161 for l in fh.read().split('\x00'):
159 162 if not entry:
160 163 if not l.startswith(':'):
@@ -171,7 +174,11 b' class convert_git(converter_source):'
171 174
172 175 if f == '.gitmodules':
173 176 subexists = True
174 changes.append(('.hgsub', ''))
177 if entry[4] == 'D':
178 subdeleted = True
179 changes.append(('.hgsub', hex(nullid)))
180 else:
181 changes.append(('.hgsub', ''))
175 182 elif entry[1] == '160000' or entry[0] == ':160000':
176 183 subexists = True
177 184 else:
@@ -182,8 +189,11 b' class convert_git(converter_source):'
182 189 raise util.Abort(_('cannot read changes in %s') % version)
183 190
184 191 if subexists:
185 self.retrievegitmodules(version)
186 changes.append(('.hgsubstate', ''))
192 if subdeleted:
193 changes.append(('.hgsubstate', hex(nullid)))
194 else:
195 self.retrievegitmodules(version)
196 changes.append(('.hgsubstate', ''))
187 197 return (changes, {})
188 198
189 199 def getcommit(self, version):
@@ -363,6 +363,23 b' convert sub modules'
363 363
364 364 $ cd ../..
365 365
366 convert the revision removing '.gitmodules' itself (and related
367 submodules)
368
369 $ cd git-repo6
370 $ git rm .gitmodules
371 rm '.gitmodules'
372 $ git rm --cached git-repo5
373 rm 'git-repo5'
374 $ commit -a -m 'remove .gitmodules and submodule git-repo5'
375 $ cd ..
376
377 $ hg convert -q git-repo6 git-repo6-hg
378 $ hg -R git-repo6-hg tip -T "{desc|firstline}\n"
379 remove .gitmodules and submodule git-repo5
380 $ hg -R git-repo6-hg tip -T "{file_dels}\n"
381 .hgsub .hgsubstate
382
366 383 damaged git repository tests:
367 384 In case the hard-coded hashes change, the following commands can be used to
368 385 list the hashes and their corresponding types in the repository:
General Comments 0
You need to be logged in to leave comments. Login now