##// END OF EJS Templates
histedit: read state from histeditstate...
David Soria Parra -
r22983:a3a98156 default
parent child Browse files
Show More
@@ -201,6 +201,24 b' class histeditstate(object):'
201 201 else:
202 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 222 def write(self):
205 223 fp = self.repo.vfs('histedit-state', 'w')
206 224 pickle.dump((self.parentctx.node(), self.rules, self.keep,
@@ -574,10 +592,12 b' def _histedit(ui, repo, *freeargs, **opt'
574 592
575 593 # rebuild state
576 594 if goal == 'continue':
577 state = readstate(repo)
595 state = histeditstate(repo)
596 state.read()
578 597 state = bootstrapcontinue(ui, state, opts)
579 598 elif goal == 'abort':
580 state = readstate(repo)
599 state = histeditstate(repo)
600 state.read()
581 601 mapping, tmpnodes, leafs, _ntm = processreplacement(repo, state)
582 602 ui.debug('restore wc to old parent %s\n' % node.short(state.topmost))
583 603 # check whether we should update away
@@ -640,8 +660,8 b' def _histedit(ui, repo, *freeargs, **opt'
640 660
641 661 parentctx = repo[root].parents()[0]
642 662
643 state = histeditstate(repo, parentctx, rules, keep,
644 topmost, replacements)
663 state = histeditstate(repo, parentctx, rules, keep, topmost,
664 replacements)
645 665
646 666 while state.rules:
647 667 state.write()
@@ -782,21 +802,6 b' def between(repo, old, new, keep):'
782 802 raise util.Abort(_('cannot edit immutable changeset: %s') % root)
783 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 805 def makedesc(c):
801 806 """build a initial action line for a ctx `c`
802 807
@@ -963,7 +968,8 b' def cleanupnode(ui, repo, name, nodes):'
963 968 def summaryhook(ui, repo):
964 969 if not os.path.exists(repo.join('histedit-state')):
965 970 return
966 state = readstate(repo)
971 state = histeditstate(repo)
972 state.read()
967 973 if state.rules:
968 974 # i18n: column positioning for "hg summary"
969 975 ui.write(_('hist: %s (histedit --continue)\n') %
General Comments 0
You need to be logged in to leave comments. Login now