157 # keepopen is not meant for use on the command line, but by |
157 # keepopen is not meant for use on the command line, but by |
158 # other extensions |
158 # other extensions |
159 self.keepopen = opts.get('keepopen', False) |
159 self.keepopen = opts.get('keepopen', False) |
160 self.obsoletenotrebased = {} |
160 self.obsoletenotrebased = {} |
161 |
161 |
162 def storestatus(self): |
162 def storestatus(self, tr=None): |
163 """Store the current status to allow recovery""" |
163 """Store the current status to allow recovery""" |
|
164 if tr: |
|
165 tr.addfilegenerator('rebasestate', ('rebasestate',), |
|
166 self._writestatus, location='plain') |
|
167 else: |
|
168 with self.repo.vfs("rebasestate", "w") as f: |
|
169 self._writestatus(f) |
|
170 |
|
171 def _writestatus(self, f): |
164 repo = self.repo |
172 repo = self.repo |
165 f = repo.vfs("rebasestate", "w") |
|
166 f.write(repo[self.originalwd].hex() + '\n') |
173 f.write(repo[self.originalwd].hex() + '\n') |
167 f.write(repo[self.target].hex() + '\n') |
174 f.write(repo[self.target].hex() + '\n') |
168 f.write(repo[self.external].hex() + '\n') |
175 f.write(repo[self.external].hex() + '\n') |
169 f.write('%d\n' % int(self.collapsef)) |
176 f.write('%d\n' % int(self.collapsef)) |
170 f.write('%d\n' % int(self.keepf)) |
177 f.write('%d\n' % int(self.keepf)) |
179 # Please do remove this special case when upgrading the format. |
186 # Please do remove this special case when upgrading the format. |
180 newrev = hex(nullid) |
187 newrev = hex(nullid) |
181 else: |
188 else: |
182 newrev = v |
189 newrev = v |
183 f.write("%s:%s\n" % (oldrev, newrev)) |
190 f.write("%s:%s\n" % (oldrev, newrev)) |
184 f.close() |
|
185 repo.ui.debug('rebase status stored\n') |
191 repo.ui.debug('rebase status stored\n') |
186 |
192 |
187 def restorestatus(self): |
193 def restorestatus(self): |
188 """Restore a previously stored status""" |
194 """Restore a previously stored status""" |
189 repo = self.repo |
195 repo = self.repo |