##// 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 94 self.modecache[(f, h)] = (p and "x") or (s and "l") or ""
95 95 changes.append((f, h))
96 96 entry = None
97 if fh.close():
98 raise util.Abort(_('cannot read changes in %s') % version)
97 99 return (changes, {})
98 100
99 101 def getcommit(self, version):
@@ -144,6 +146,8 b' class convert_git(converter_source):'
144 146 continue
145 147 tag = tag[len(prefix):-3]
146 148 tags[tag] = node
149 if fh.close():
150 raise util.Abort(_('cannot read tags from %s') % self.path)
147 151
148 152 return tags
149 153
@@ -156,11 +160,11 b' class convert_git(converter_source):'
156 160 continue
157 161 m, f = l[:-1].split("\t")
158 162 changes.append(f)
159 fh.close()
160 163 else:
161 164 fh = self.gitopen('git diff-tree --name-only --root -r %s "%s^%s" --'
162 165 % (version, version, i + 1))
163 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 170 return changes
@@ -170,4 +170,17 b' hg -R git-repo4-hg log -v'
170 170 echo '% --sourceorder should fail'
171 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 186 true
@@ -127,3 +127,11 b' addfoo'
127 127 % --sourceorder should fail
128 128 initializing destination git-repo4-sourcesort-hg repository
129 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