##// END OF EJS Templates
convert/git: check status when reading output stream
Patrick Mezard -
r10987:b3af02b1 stable
parent child Browse files
Show More
@@ -94,6 +94,8 b' class convert_git(converter_source):'
94 self.modecache[(f, h)] = (p and "x") or (s and "l") or ""
94 self.modecache[(f, h)] = (p and "x") or (s and "l") or ""
95 changes.append((f, h))
95 changes.append((f, h))
96 entry = None
96 entry = None
97 if fh.close():
98 raise util.Abort(_('cannot read changes in %s') % version)
97 return (changes, {})
99 return (changes, {})
98
100
99 def getcommit(self, version):
101 def getcommit(self, version):
@@ -144,6 +146,8 b' class convert_git(converter_source):'
144 continue
146 continue
145 tag = tag[len(prefix):-3]
147 tag = tag[len(prefix):-3]
146 tags[tag] = node
148 tags[tag] = node
149 if fh.close():
150 raise util.Abort(_('cannot read tags from %s') % self.path)
147
151
148 return tags
152 return tags
149
153
@@ -156,11 +160,11 b' class convert_git(converter_source):'
156 continue
160 continue
157 m, f = l[:-1].split("\t")
161 m, f = l[:-1].split("\t")
158 changes.append(f)
162 changes.append(f)
159 fh.close()
160 else:
163 else:
161 fh = self.gitopen('git diff-tree --name-only --root -r %s "%s^%s" --'
164 fh = self.gitopen('git diff-tree --name-only --root -r %s "%s^%s" --'
162 % (version, version, i + 1))
165 % (version, version, i + 1))
163 changes = [f.rstrip('\n') for f in fh]
166 changes = [f.rstrip('\n') for f in fh]
164 fh.close()
167 if fh.close():
168 raise util.Abort(_('cannot read changes in %s') % version)
165
169
166 return changes
170 return changes
@@ -170,4 +170,17 b' hg -R git-repo4-hg log -v'
170 echo '% --sourceorder should fail'
170 echo '% --sourceorder should fail'
171 hg convert --sourcesort git-repo4 git-repo4-sourcesort-hg
171 hg convert --sourcesort git-repo4 git-repo4-sourcesort-hg
172
172
173 echo '% damage git repository and convert again'
174 cat > damage.py <<EOF
175 import os
176 for root, dirs, files in os.walk('git-repo4/.git/objects'):
177 if files:
178 path = os.path.join(root, files[0])
179 os.remove(path)
180 break
181 EOF
182 python damage.py
183 hg convert git-repo4 git-repo4-broken-hg 2>&1 | \
184 sed 's/fatal:.*/fatal: git error/g'
185
173 true
186 true
@@ -127,3 +127,11 b' addfoo'
127 % --sourceorder should fail
127 % --sourceorder should fail
128 initializing destination git-repo4-sourcesort-hg repository
128 initializing destination git-repo4-sourcesort-hg repository
129 abort: --sourcesort is not supported by this data source
129 abort: --sourcesort is not supported by this data source
130 % damage git repository and convert again
131 fatal: git error
132 initializing destination git-repo4-broken-hg repository
133 scanning source...
134 sorting...
135 converting...
136 1 addfoo
137 abort: cannot read changes in 6a101ac3f6d8b2524a64295ffd9be87ed927bfeb
General Comments 0
You need to be logged in to leave comments. Login now