comparison hgext/histedit.py @ 28154:47f56b6bfed1

histedit: renaming parts to which _histedit was split I recently broke _histedit into multiple functions, each of which had 'action' in its name. This is a little bit confusing since 'action' is the word for an individual histedit plan item (such as edit or pick). To avoid this confusion, these functions are now renamed to contain 'histedit' as part of their names.
author Kostia Balytskyi <ikostia@fb.com>
date Mon, 15 Feb 2016 14:57:06 +0000
parents 17c474fdb225
children 2e11f6756d9c
comparison
equal deleted inserted replaced
28153:17c474fdb225 28154:47f56b6bfed1
1052 # rebuild state 1052 # rebuild state
1053 if goal == goalcontinue: 1053 if goal == goalcontinue:
1054 state.read() 1054 state.read()
1055 state = bootstrapcontinue(ui, state, opts) 1055 state = bootstrapcontinue(ui, state, opts)
1056 elif goal == goaleditplan: 1056 elif goal == goaleditplan:
1057 _editplanaction(ui, repo, state, rules) 1057 _edithisteditplan(ui, repo, state, rules)
1058 return 1058 return
1059 elif goal == goalabort: 1059 elif goal == goalabort:
1060 _abortaction(ui, repo, state) 1060 _aborthistedit(ui, repo, state)
1061 return 1061 return
1062 else: 1062 else:
1063 # goal == goalnew 1063 # goal == goalnew
1064 _newaction(ui, repo, state, revs, freeargs, opts) 1064 _newhistedit(ui, repo, state, revs, freeargs, opts)
1065 1065
1066 _continueaction(ui, repo, state) 1066 _continuehistedit(ui, repo, state)
1067 _finishaction(ui, repo, state) 1067 _finishhistedit(ui, repo, state)
1068 1068
1069 def _continueaction(ui, repo, state): 1069 def _continuehistedit(ui, repo, state):
1070 """This action runs after either: 1070 """This function runs after either:
1071 - bootstrapcontinue (if the goal is 'continue') 1071 - bootstrapcontinue (if the goal is 'continue')
1072 - _newaction (if the goal is 'new') 1072 - _newhistedit (if the goal is 'new')
1073 """ 1073 """
1074 # preprocess rules so that we can hide inner folds from the user 1074 # preprocess rules so that we can hide inner folds from the user
1075 # and only show one editor 1075 # and only show one editor
1076 actions = state.actions[:] 1076 actions = state.actions[:]
1077 for idx, (action, nextact) in enumerate( 1077 for idx, (action, nextact) in enumerate(
1093 state.parentctxnode = parentctx.node() 1093 state.parentctxnode = parentctx.node()
1094 state.replacements.extend(replacement_) 1094 state.replacements.extend(replacement_)
1095 state.write() 1095 state.write()
1096 ui.progress(_("editing"), None) 1096 ui.progress(_("editing"), None)
1097 1097
1098 def _finishaction(ui, repo, state): 1098 def _finishhistedit(ui, repo, state):
1099 """This action runs when histedit is finishing its session""" 1099 """This action runs when histedit is finishing its session"""
1100 repo.ui.pushbuffer() 1100 repo.ui.pushbuffer()
1101 hg.update(repo, state.parentctxnode, quietempty=True) 1101 hg.update(repo, state.parentctxnode, quietempty=True)
1102 repo.ui.popbuffer() 1102 repo.ui.popbuffer()
1103 1103
1142 if os.path.exists(repo.sjoin('undo')): 1142 if os.path.exists(repo.sjoin('undo')):
1143 os.unlink(repo.sjoin('undo')) 1143 os.unlink(repo.sjoin('undo'))
1144 if repo.vfs.exists('histedit-last-edit.txt'): 1144 if repo.vfs.exists('histedit-last-edit.txt'):
1145 repo.vfs.unlink('histedit-last-edit.txt') 1145 repo.vfs.unlink('histedit-last-edit.txt')
1146 1146
1147 def _abortaction(ui, repo, state): 1147 def _aborthistedit(ui, repo, state):
1148 try: 1148 try:
1149 state.read() 1149 state.read()
1150 tmpnodes, leafs = newnodestoabort(state) 1150 tmpnodes, leafs = newnodestoabort(state)
1151 ui.debug('restore wc to old parent %s\n' 1151 ui.debug('restore wc to old parent %s\n'
1152 % node.short(state.topmost)) 1152 % node.short(state.topmost))
1179 'cleaned up\n')) 1179 'cleaned up\n'))
1180 raise 1180 raise
1181 finally: 1181 finally:
1182 state.clear() 1182 state.clear()
1183 1183
1184 def _editplanaction(ui, repo, state, rules): 1184 def _edithisteditplan(ui, repo, state, rules):
1185 state.read() 1185 state.read()
1186 if not rules: 1186 if not rules:
1187 comment = geteditcomment(node.short(state.parentctxnode), 1187 comment = geteditcomment(node.short(state.parentctxnode),
1188 node.short(state.topmost)) 1188 node.short(state.topmost))
1189 rules = ruleeditor(repo, ui, state.actions, comment) 1189 rules = ruleeditor(repo, ui, state.actions, comment)
1199 for act in state.actions if act.nodetoverify()] 1199 for act in state.actions if act.nodetoverify()]
1200 warnverifyactions(ui, repo, actions, state, ctxs) 1200 warnverifyactions(ui, repo, actions, state, ctxs)
1201 state.actions = actions 1201 state.actions = actions
1202 state.write() 1202 state.write()
1203 1203
1204 def _newaction(ui, repo, state, revs, freeargs, opts): 1204 def _newhistedit(ui, repo, state, revs, freeargs, opts):
1205 outg = opts.get('outgoing') 1205 outg = opts.get('outgoing')
1206 rules = opts.get('commands', '') 1206 rules = opts.get('commands', '')
1207 force = opts.get('force') 1207 force = opts.get('force')
1208 1208
1209 cmdutil.checkunfinished(repo) 1209 cmdutil.checkunfinished(repo)