# HG changeset patch # User Pierre-Yves David # Date 2015-10-14 22:42:15 # Node ID fd4a38bd7e49bfea59a018e4354bd6ca2ee52018 # Parent ab1af5e7d73460834dda349f9c97ca32d7800595 rebase: use a direct reference to repo.changelog Accessing 'repo.changelog' have a small overhead because we double check that the filtering did not changed. As we make multiple use of this into loops, we should avoid doing the lookup/check every time. This also make the code tidier. diff --git a/hgext/rebase.py b/hgext/rebase.py --- a/hgext/rebase.py +++ b/hgext/rebase.py @@ -1161,19 +1161,20 @@ def _computeobsoletenotrebased(repo, reb # Build a mapping succesor => obsolete nodes for the obsolete # nodes to be rebased allsuccessors = {} + cl = repo.changelog for r in rebasesetrevs: n = repo[r] if n.obsolete(): - node = repo.changelog.node(r) + node = cl.node(r) for s in obsolete.allsuccessors(repo.obsstore, [node]): - allsuccessors[repo.changelog.rev(s)] = repo.changelog.rev(node) + allsuccessors[cl.rev(s)] = cl.rev(node) if allsuccessors: # Look for successors of obsolete nodes to be rebased among # the ancestors of dest - ancs = repo.changelog.ancestors([repo[dest].rev()], - stoprev=min(allsuccessors), - inclusive=True) + ancs = cl.ancestors([repo[dest].rev()], + stoprev=min(allsuccessors), + inclusive=True) for s in allsuccessors: if s in ancs: obsoletenotrebased[allsuccessors[s]] = s