Show More
@@ -201,6 +201,24 b' class histeditstate(object):' | |||||
201 | else: |
|
201 | else: | |
202 | self.replacements = replacements |
|
202 | self.replacements = replacements | |
203 |
|
203 | |||
|
204 | def read(self): | |||
|
205 | """Reads a state from file and returns a histeditstate object | |||
|
206 | """ | |||
|
207 | try: | |||
|
208 | fp = self.repo.vfs('histedit-state', 'r') | |||
|
209 | except IOError, err: | |||
|
210 | if err.errno != errno.ENOENT: | |||
|
211 | raise | |||
|
212 | raise util.Abort(_('no histedit in progress')) | |||
|
213 | ||||
|
214 | (parentctxnode, rules, keep, topmost, replacements) = pickle.load(fp) | |||
|
215 | ||||
|
216 | self.parentctx = self.repo[parentctxnode] | |||
|
217 | self.rules = rules | |||
|
218 | self.keep = keep | |||
|
219 | self.topmost = topmost | |||
|
220 | self.replacements = replacements | |||
|
221 | ||||
204 | def write(self): |
|
222 | def write(self): | |
205 | fp = self.repo.vfs('histedit-state', 'w') |
|
223 | fp = self.repo.vfs('histedit-state', 'w') | |
206 | pickle.dump((self.parentctx.node(), self.rules, self.keep, |
|
224 | pickle.dump((self.parentctx.node(), self.rules, self.keep, | |
@@ -574,10 +592,12 b' def _histedit(ui, repo, *freeargs, **opt' | |||||
574 |
|
592 | |||
575 | # rebuild state |
|
593 | # rebuild state | |
576 | if goal == 'continue': |
|
594 | if goal == 'continue': | |
577 |
state = |
|
595 | state = histeditstate(repo) | |
|
596 | state.read() | |||
578 | state = bootstrapcontinue(ui, state, opts) |
|
597 | state = bootstrapcontinue(ui, state, opts) | |
579 | elif goal == 'abort': |
|
598 | elif goal == 'abort': | |
580 |
state = |
|
599 | state = histeditstate(repo) | |
|
600 | state.read() | |||
581 | mapping, tmpnodes, leafs, _ntm = processreplacement(repo, state) |
|
601 | mapping, tmpnodes, leafs, _ntm = processreplacement(repo, state) | |
582 | ui.debug('restore wc to old parent %s\n' % node.short(state.topmost)) |
|
602 | ui.debug('restore wc to old parent %s\n' % node.short(state.topmost)) | |
583 | # check whether we should update away |
|
603 | # check whether we should update away | |
@@ -640,8 +660,8 b' def _histedit(ui, repo, *freeargs, **opt' | |||||
640 |
|
660 | |||
641 | parentctx = repo[root].parents()[0] |
|
661 | parentctx = repo[root].parents()[0] | |
642 |
|
662 | |||
643 | state = histeditstate(repo, parentctx, rules, keep, |
|
663 | state = histeditstate(repo, parentctx, rules, keep, topmost, | |
644 |
|
|
664 | replacements) | |
645 |
|
665 | |||
646 | while state.rules: |
|
666 | while state.rules: | |
647 | state.write() |
|
667 | state.write() | |
@@ -782,21 +802,6 b' def between(repo, old, new, keep):' | |||||
782 | raise util.Abort(_('cannot edit immutable changeset: %s') % root) |
|
802 | raise util.Abort(_('cannot edit immutable changeset: %s') % root) | |
783 | return [c.node() for c in ctxs] |
|
803 | return [c.node() for c in ctxs] | |
784 |
|
804 | |||
785 | def readstate(repo): |
|
|||
786 | """Reads a state from file and returns a histeditstate object |
|
|||
787 | """ |
|
|||
788 | try: |
|
|||
789 | fp = repo.vfs('histedit-state', 'r') |
|
|||
790 | except IOError, err: |
|
|||
791 | if err.errno != errno.ENOENT: |
|
|||
792 | raise |
|
|||
793 | raise util.Abort(_('no histedit in progress')) |
|
|||
794 |
|
||||
795 | (parentctxnode, rules, keep, topmost, replacements) = pickle.load(fp) |
|
|||
796 |
|
||||
797 | return histeditstate(repo, repo[parentctxnode], rules, |
|
|||
798 | keep, topmost, replacements) |
|
|||
799 |
|
||||
800 | def makedesc(c): |
|
805 | def makedesc(c): | |
801 | """build a initial action line for a ctx `c` |
|
806 | """build a initial action line for a ctx `c` | |
802 |
|
807 | |||
@@ -963,7 +968,8 b' def cleanupnode(ui, repo, name, nodes):' | |||||
963 | def summaryhook(ui, repo): |
|
968 | def summaryhook(ui, repo): | |
964 | if not os.path.exists(repo.join('histedit-state')): |
|
969 | if not os.path.exists(repo.join('histedit-state')): | |
965 | return |
|
970 | return | |
966 |
state = |
|
971 | state = histeditstate(repo) | |
|
972 | state.read() | |||
967 | if state.rules: |
|
973 | if state.rules: | |
968 | # i18n: column positioning for "hg summary" |
|
974 | # i18n: column positioning for "hg summary" | |
969 | ui.write(_('hist: %s (histedit --continue)\n') % |
|
975 | ui.write(_('hist: %s (histedit --continue)\n') % |
General Comments 0
You need to be logged in to leave comments.
Login now