##// END OF EJS Templates
histedit: move locks into state...
David Soria Parra -
r22984:e0b5f5e3 default
parent child Browse files
Show More
@@ -190,12 +190,14 b' editcomment = _("""# Edit history betwee'
190
190
191 class histeditstate(object):
191 class histeditstate(object):
192 def __init__(self, repo, parentctx=None, rules=None, keep=None,
192 def __init__(self, repo, parentctx=None, rules=None, keep=None,
193 topmost=None, replacements=None):
193 topmost=None, replacements=None, lock=None, wlock=None):
194 self.repo = repo
194 self.repo = repo
195 self.rules = rules
195 self.rules = rules
196 self.keep = keep
196 self.keep = keep
197 self.topmost = topmost
197 self.topmost = topmost
198 self.parentctx = parentctx
198 self.parentctx = parentctx
199 self.lock = lock
200 self.wlock = wlock
199 if replacements is None:
201 if replacements is None:
200 self.replacements = []
202 self.replacements = []
201 else:
203 else:
@@ -537,15 +539,15 b' def histedit(ui, repo, *freeargs, **opts'
537 for intentional "edit" command, but also for resolving unexpected
539 for intentional "edit" command, but also for resolving unexpected
538 conflicts).
540 conflicts).
539 """
541 """
540 lock = wlock = None
542 state = histeditstate(repo)
541 try:
543 try:
542 wlock = repo.wlock()
544 state.wlock = repo.wlock()
543 lock = repo.lock()
545 state.lock = repo.lock()
544 _histedit(ui, repo, *freeargs, **opts)
546 _histedit(ui, repo, state, *freeargs, **opts)
545 finally:
547 finally:
546 release(lock, wlock)
548 release(state.lock, state.wlock)
547
549
548 def _histedit(ui, repo, *freeargs, **opts):
550 def _histedit(ui, repo, state, *freeargs, **opts):
549 # TODO only abort if we try and histedit mq patches, not just
551 # TODO only abort if we try and histedit mq patches, not just
550 # blanket if mq patches are applied somewhere
552 # blanket if mq patches are applied somewhere
551 mq = getattr(repo, 'mq', None)
553 mq = getattr(repo, 'mq', None)
@@ -660,8 +662,11 b' def _histedit(ui, repo, *freeargs, **opt'
660
662
661 parentctx = repo[root].parents()[0]
663 parentctx = repo[root].parents()[0]
662
664
663 state = histeditstate(repo, parentctx, rules, keep, topmost,
665 state.parentctx = parentctx
664 replacements)
666 state.rules = rules
667 state.keep = keep
668 state.topmost = topmost
669 state.replacements = replacements
665
670
666 while state.rules:
671 while state.rules:
667 state.write()
672 state.write()
General Comments 0
You need to be logged in to leave comments. Login now