comparison hgext/rebase.py @ 29475:fb7fc877ed17

rebase: move local variable 'currentbookmarks' to the RR class
author Kostia Balytskyi <ikostia@fb.com>
date Fri, 01 Jul 2016 14:09:53 +0200
parents 56641501adde
children 48188ceb3c43
comparison
equal deleted inserted replaced
29474:56641501adde 29475:fb7fc877ed17
133 # Mapping between the old revision id and either what is the new rebased 133 # Mapping between the old revision id and either what is the new rebased
134 # revision or what needs to be done with the old revision. The state 134 # revision or what needs to be done with the old revision. The state
135 # dict will be what contains most of the rebase progress state. 135 # dict will be what contains most of the rebase progress state.
136 self.state = {} 136 self.state = {}
137 self.activebookmark = None 137 self.activebookmark = None
138 self.currentbookmarks = None
138 self.target = None 139 self.target = None
139 self.skipped = set() 140 self.skipped = set()
140 self.targetancestors = set() 141 self.targetancestors = set()
141 142
142 self.collapsef = opts.get('collapse', False) 143 self.collapsef = opts.get('collapse', False)
490 if not rbsrt.targetancestors: 491 if not rbsrt.targetancestors:
491 rbsrt.targetancestors = repo.changelog.ancestors([rbsrt.target], 492 rbsrt.targetancestors = repo.changelog.ancestors([rbsrt.target],
492 inclusive=True) 493 inclusive=True)
493 494
494 # Keep track of the current bookmarks in order to reset them later 495 # Keep track of the current bookmarks in order to reset them later
495 currentbookmarks = repo._bookmarks.copy() 496 rbsrt.currentbookmarks = repo._bookmarks.copy()
496 rbsrt.activebookmark = rbsrt.activebookmark or repo._activebookmark 497 rbsrt.activebookmark = rbsrt.activebookmark or repo._activebookmark
497 if rbsrt.activebookmark: 498 if rbsrt.activebookmark:
498 bookmarks.deactivate(repo) 499 bookmarks.deactivate(repo)
499 500
500 extrafn = _makeextrafn(rbsrt.extrafns) 501 extrafn = _makeextrafn(rbsrt.extrafns)
614 rbsrt.state[oldrev] = newrev 615 rbsrt.state[oldrev] = newrev
615 616
616 if 'qtip' in repo.tags(): 617 if 'qtip' in repo.tags():
617 updatemq(repo, rbsrt.state, rbsrt.skipped, **opts) 618 updatemq(repo, rbsrt.state, rbsrt.skipped, **opts)
618 619
619 if currentbookmarks: 620 if rbsrt.currentbookmarks:
620 # Nodeids are needed to reset bookmarks 621 # Nodeids are needed to reset bookmarks
621 nstate = {} 622 nstate = {}
622 for k, v in rbsrt.state.iteritems(): 623 for k, v in rbsrt.state.iteritems():
623 if v > nullmerge: 624 if v > nullmerge:
624 nstate[repo[k].node()] = repo[v].node() 625 nstate[repo[k].node()] = repo[v].node()
646 if rbsrt.collapsef: 647 if rbsrt.collapsef:
647 collapsedas = newnode 648 collapsedas = newnode
648 clearrebased(ui, repo, rbsrt.state, rbsrt.skipped, collapsedas) 649 clearrebased(ui, repo, rbsrt.state, rbsrt.skipped, collapsedas)
649 650
650 with repo.transaction('bookmark') as tr: 651 with repo.transaction('bookmark') as tr:
651 if currentbookmarks: 652 if rbsrt.currentbookmarks:
652 updatebookmarks(repo, targetnode, nstate, currentbookmarks, tr) 653 updatebookmarks(repo, targetnode, nstate,
654 rbsrt.currentbookmarks, tr)
653 if rbsrt.activebookmark not in repo._bookmarks: 655 if rbsrt.activebookmark not in repo._bookmarks:
654 # active bookmark was divergent one and has been deleted 656 # active bookmark was divergent one and has been deleted
655 rbsrt.activebookmark = None 657 rbsrt.activebookmark = None
656 clearstatus(repo) 658 clearstatus(repo)
657 clearcollapsemsg(repo) 659 clearcollapsemsg(repo)