Show More
@@ -104,6 +104,8 b' class convert_git(converter_source):' | |||||
104 | return data |
|
104 | return data | |
105 |
|
105 | |||
106 | def getfile(self, name, rev): |
|
106 | def getfile(self, name, rev): | |
|
107 | if rev == hex(nullid): | |||
|
108 | raise IOError | |||
107 | if name == '.hgsub': |
|
109 | if name == '.hgsub': | |
108 | data = '\n'.join([m.hgsub() for m in self.submoditer()]) |
|
110 | data = '\n'.join([m.hgsub() for m in self.submoditer()]) | |
109 | mode = '' |
|
111 | mode = '' | |
@@ -155,6 +157,7 b' class convert_git(converter_source):' | |||||
155 | seen = set() |
|
157 | seen = set() | |
156 | entry = None |
|
158 | entry = None | |
157 | subexists = False |
|
159 | subexists = False | |
|
160 | subdeleted = False | |||
158 | for l in fh.read().split('\x00'): |
|
161 | for l in fh.read().split('\x00'): | |
159 | if not entry: |
|
162 | if not entry: | |
160 | if not l.startswith(':'): |
|
163 | if not l.startswith(':'): | |
@@ -171,7 +174,11 b' class convert_git(converter_source):' | |||||
171 |
|
174 | |||
172 | if f == '.gitmodules': |
|
175 | if f == '.gitmodules': | |
173 | subexists = True |
|
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 | elif entry[1] == '160000' or entry[0] == ':160000': |
|
182 | elif entry[1] == '160000' or entry[0] == ':160000': | |
176 | subexists = True |
|
183 | subexists = True | |
177 | else: |
|
184 | else: | |
@@ -182,8 +189,11 b' class convert_git(converter_source):' | |||||
182 | raise util.Abort(_('cannot read changes in %s') % version) |
|
189 | raise util.Abort(_('cannot read changes in %s') % version) | |
183 |
|
190 | |||
184 | if subexists: |
|
191 | if subexists: | |
185 | self.retrievegitmodules(version) |
|
192 | if subdeleted: | |
186 |
changes.append(('.hgsubstate', |
|
193 | changes.append(('.hgsubstate', hex(nullid))) | |
|
194 | else: | |||
|
195 | self.retrievegitmodules(version) | |||
|
196 | changes.append(('.hgsubstate', '')) | |||
187 | return (changes, {}) |
|
197 | return (changes, {}) | |
188 |
|
198 | |||
189 | def getcommit(self, version): |
|
199 | def getcommit(self, version): |
@@ -363,6 +363,23 b' convert sub modules' | |||||
363 |
|
363 | |||
364 | $ cd ../.. |
|
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 | damaged git repository tests: |
|
383 | damaged git repository tests: | |
367 | In case the hard-coded hashes change, the following commands can be used to |
|
384 | In case the hard-coded hashes change, the following commands can be used to | |
368 | list the hashes and their corresponding types in the repository: |
|
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