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