##// END OF EJS Templates
revlog: fix a bug where transaction can be aborted partially...
Arseniy Alekseyev -
r49423:ccd9cb73 stable
parent child Browse files
Show More
@@ -2006,7 +2006,7 b' class revlog(object):'
2006 2006 raise error.RevlogError(
2007 2007 _(b"%s not found in the transaction") % self._indexfile
2008 2008 )
2009 trindex = 0
2009 trindex = None
2010 2010 tr.add(self._datafile, 0)
2011 2011
2012 2012 existing_handles = False
@@ -2029,10 +2029,17 b' class revlog(object):'
2029 2029 with self._indexfp() as read_ifh:
2030 2030 for r in self:
2031 2031 new_dfh.write(self._getsegmentforrevs(r, r, df=read_ifh)[1])
2032 if troffset <= self.start(r) + r * self.index.entry_size:
2032 if (
2033 trindex is None
2034 and troffset
2035 <= self.start(r) + r * self.index.entry_size
2036 ):
2033 2037 trindex = r
2034 2038 new_dfh.flush()
2035 2039
2040 if trindex is None:
2041 trindex = 0
2042
2036 2043 with self.__index_new_fp() as fp:
2037 2044 self._format_flags &= ~FLAG_INLINE_DATA
2038 2045 self._inline = False
@@ -63,7 +63,7 b' Reference size:'
63 63 [80]
64 64 #endif
65 65 $ cat .hg/store/journal | tr -s '\000' ' ' | grep data/file | tail -1
66 data/file.i 192
66 data/file.i 128
67 67
68 68 The first file.i entry should match the "Reference size" above.
69 69 The first file.d entry is the temporary record during the split,
@@ -73,14 +73,14 b' and the second file.i entry should match'
73 73 $ cat .hg/store/journal | tr -s '\000' ' ' | grep data/file
74 74 data/file.i 1174
75 75 data/file.d 0
76 data/file.d 1067
77 data/file.i 192
76 data/file.d 1046
77 data/file.i 128
78 78 $ hg recover
79 79 rolling back interrupted transaction
80 80 (verify step skipped, run `hg verify` to check your repository content)
81 81 $ f -s .hg/store/data/file*
82 .hg/store/data/file.d: size=1067
83 .hg/store/data/file.i: size=192
82 .hg/store/data/file.d: size=1046
83 .hg/store/data/file.i: size=128
84 84 $ hg tip
85 85 changeset: 1:cfa8d6e60429
86 86 tag: tip
@@ -90,23 +90,12 b' and the second file.i entry should match'
90 90
91 91 $ hg verify -q
92 92 warning: revlog 'data/file.d' not in fncache!
93 file@?: rev 2 points to nonexistent changeset 2
94 (expected )
95 file@?: fa1120531cc1 not in manifests
96 2 warnings encountered!
93 1 warnings encountered!
97 94 hint: run "hg debugrebuildfncache" to recover from corrupt fncache
98 2 integrity errors encountered!
99 [1]
100 95 $ hg debugrebuildfncache --only-data
101 96 adding data/file.d
102 97 1 items added, 0 removed from fncache
103 98 $ hg verify -q
104 file@?: rev 2 points to nonexistent changeset 2
105 (expected )
106 file@?: fa1120531cc1 not in manifests
107 1 warnings encountered!
108 2 integrity errors encountered!
109 [1]
110 99 $ cd ..
111 100
112 101
@@ -134,13 +123,13 b' where the data file is left as garbage.'
134 123 $ cat .hg/store/journal | tr -s '\000' ' ' | grep data/file
135 124 data/file.i 1174
136 125 data/file.d 0
137 data/file.d 1067
126 data/file.d 1046
138 127
139 128 $ hg recover
140 129 rolling back interrupted transaction
141 130 (verify step skipped, run `hg verify` to check your repository content)
142 131 $ f -s .hg/store/data/file*
143 .hg/store/data/file.d: size=1067
132 .hg/store/data/file.d: size=1046
144 133 .hg/store/data/file.i: size=1174
145 134 $ hg tip
146 135 changeset: 1:cfa8d6e60429
@@ -172,8 +161,8 b' Repeat the original test but let hg roll'
172 161 abort: pretxnchangegroup hook exited with status 1
173 162 [40]
174 163 $ f -s .hg/store/data/file*
175 .hg/store/data/file.d: size=1067
176 .hg/store/data/file.i: size=192
164 .hg/store/data/file.d: size=1046
165 .hg/store/data/file.i: size=128
177 166 $ hg tip
178 167 changeset: 1:cfa8d6e60429
179 168 tag: tip
@@ -183,12 +172,7 b' Repeat the original test but let hg roll'
183 172
184 173 $ hg verify -q
185 174 warning: revlog 'data/file.d' not in fncache!
186 file@?: rev 2 points to nonexistent changeset 2
187 (expected )
188 file@?: fa1120531cc1 not in manifests
189 2 warnings encountered!
175 1 warnings encountered!
190 176 hint: run "hg debugrebuildfncache" to recover from corrupt fncache
191 2 integrity errors encountered!
192 [1]
193 177 $ cd ..
194 178
General Comments 0
You need to be logged in to leave comments. Login now