Show More
@@ -159,6 +159,31 b' class rebaseruntime(object):' | |||||
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): | |||
|
163 | """Store the current status to allow recovery""" | |||
|
164 | repo = self.repo | |||
|
165 | f = repo.vfs("rebasestate", "w") | |||
|
166 | f.write(repo[self.originalwd].hex() + '\n') | |||
|
167 | f.write(repo[self.target].hex() + '\n') | |||
|
168 | f.write(repo[self.external].hex() + '\n') | |||
|
169 | f.write('%d\n' % int(self.collapsef)) | |||
|
170 | f.write('%d\n' % int(self.keepf)) | |||
|
171 | f.write('%d\n' % int(self.keepbranchesf)) | |||
|
172 | f.write('%s\n' % (self.activebookmark or '')) | |||
|
173 | for d, v in self.state.iteritems(): | |||
|
174 | oldrev = repo[d].hex() | |||
|
175 | if v >= 0: | |||
|
176 | newrev = repo[v].hex() | |||
|
177 | elif v == revtodo: | |||
|
178 | # To maintain format compatibility, we have to use nullid. | |||
|
179 | # Please do remove this special case when upgrading the format. | |||
|
180 | newrev = hex(nullid) | |||
|
181 | else: | |||
|
182 | newrev = v | |||
|
183 | f.write("%s:%s\n" % (oldrev, newrev)) | |||
|
184 | f.close() | |||
|
185 | repo.ui.debug('rebase status stored\n') | |||
|
186 | ||||
162 | def restorestatus(self): |
|
187 | def restorestatus(self): | |
163 | """Restore a previously stored status""" |
|
188 | """Restore a previously stored status""" | |
164 | repo = self.repo |
|
189 | repo = self.repo | |
@@ -358,10 +383,7 b' class rebaseruntime(object):' | |||||
358 | self.state, |
|
383 | self.state, | |
359 | self.targetancestors, |
|
384 | self.targetancestors, | |
360 | self.obsoletenotrebased) |
|
385 | self.obsoletenotrebased) | |
361 | storestatus(repo, self.originalwd, self.target, |
|
386 | self.storestatus() | |
362 | self.state, self.collapsef, self.keepf, |
|
|||
363 | self.keepbranchesf, self.external, |
|
|||
364 | self.activebookmark) |
|
|||
365 | storecollapsemsg(repo, self.collapsemsg) |
|
387 | storecollapsemsg(repo, self.collapsemsg) | |
366 | if len(repo[None].parents()) == 2: |
|
388 | if len(repo[None].parents()) == 2: | |
367 | repo.ui.debug('resuming interrupted rebase\n') |
|
389 | repo.ui.debug('resuming interrupted rebase\n') | |
@@ -1076,31 +1098,6 b' def restorecollapsemsg(repo):' | |||||
1076 | raise error.Abort(_('no rebase in progress')) |
|
1098 | raise error.Abort(_('no rebase in progress')) | |
1077 | return collapsemsg |
|
1099 | return collapsemsg | |
1078 |
|
1100 | |||
1079 | def storestatus(repo, originalwd, target, state, collapse, keep, keepbranches, |
|
|||
1080 | external, activebookmark): |
|
|||
1081 | 'Store the current status to allow recovery' |
|
|||
1082 | f = repo.vfs("rebasestate", "w") |
|
|||
1083 | f.write(repo[originalwd].hex() + '\n') |
|
|||
1084 | f.write(repo[target].hex() + '\n') |
|
|||
1085 | f.write(repo[external].hex() + '\n') |
|
|||
1086 | f.write('%d\n' % int(collapse)) |
|
|||
1087 | f.write('%d\n' % int(keep)) |
|
|||
1088 | f.write('%d\n' % int(keepbranches)) |
|
|||
1089 | f.write('%s\n' % (activebookmark or '')) |
|
|||
1090 | for d, v in state.iteritems(): |
|
|||
1091 | oldrev = repo[d].hex() |
|
|||
1092 | if v >= 0: |
|
|||
1093 | newrev = repo[v].hex() |
|
|||
1094 | elif v == revtodo: |
|
|||
1095 | # To maintain format compatibility, we have to use nullid. |
|
|||
1096 | # Please do remove this special case when upgrading the format. |
|
|||
1097 | newrev = hex(nullid) |
|
|||
1098 | else: |
|
|||
1099 | newrev = v |
|
|||
1100 | f.write("%s:%s\n" % (oldrev, newrev)) |
|
|||
1101 | f.close() |
|
|||
1102 | repo.ui.debug('rebase status stored\n') |
|
|||
1103 |
|
||||
1104 | def clearstatus(repo): |
|
1101 | def clearstatus(repo): | |
1105 | 'Remove the status files' |
|
1102 | 'Remove the status files' | |
1106 | _clearrebasesetvisibiliy(repo) |
|
1103 | _clearrebasesetvisibiliy(repo) |
General Comments 0
You need to be logged in to leave comments.
Login now