comparison hgext/rebase.py @ 37037:bd0086bd3af4

rebase: inline _makextrafn() now that we have only one caller Also avoid even creating a function since we just end up calling it right away. Differential Revision: https://phab.mercurial-scm.org/D2918
author Martin von Zweigbergk <martinvonz@google.com>
date Tue, 20 Mar 2018 21:45:48 -0700
parents 0ab0d94ead72
children 7db86856f27f
comparison
equal deleted inserted replaced
37036:0ab0d94ead72 37037:bd0086bd3af4
84 if s is not None: 84 if s is not None:
85 extra['intermediate-source'] = s 85 extra['intermediate-source'] = s
86 86
87 def _savebranch(ctx, extra): 87 def _savebranch(ctx, extra):
88 extra['branch'] = ctx.branch() 88 extra['branch'] = ctx.branch()
89
90 def _makeextrafn(copiers):
91 """make an extrafn out of the given copy-functions.
92
93 A copy function takes a context and an extra dict, and mutates the
94 extra dict as needed based on the given context.
95 """
96 def extrafn(ctx, extra):
97 for c in copiers:
98 c(ctx, extra)
99 return extrafn
100 89
101 def _destrebase(repo, sourceset, destspace=None): 90 def _destrebase(repo, sourceset, destspace=None):
102 """small wrapper around destmerge to pass the right extra args 91 """small wrapper around destmerge to pass the right extra args
103 92
104 Please wrap destutil.destmerge instead.""" 93 Please wrap destutil.destmerge instead."""
455 Return node of committed revision.''' 444 Return node of committed revision.'''
456 repo = self.repo 445 repo = self.repo
457 ctx = repo[rev] 446 ctx = repo[rev]
458 if commitmsg is None: 447 if commitmsg is None:
459 commitmsg = ctx.description() 448 commitmsg = ctx.description()
460 extrafn = _makeextrafn(self.extrafns)
461 extra = {'rebase_source': ctx.hex()} 449 extra = {'rebase_source': ctx.hex()}
462 if extrafn: 450 for c in self.extrafns:
463 extrafn(ctx, extra) 451 c(ctx, extra)
464 if self.inmemory: 452 if self.inmemory:
465 newnode = concludememorynode(repo, ctx, p1, p2, 453 newnode = concludememorynode(repo, ctx, p1, p2,
466 wctx=self.wctx, 454 wctx=self.wctx,
467 extra=extra, 455 extra=extra,
468 commitmsg=commitmsg, 456 commitmsg=commitmsg,