Mercurial > hg > hg-git
changeset 714:96f0463a4e54
revset_gitnode: use repo.changelog.node instead of contexts
For a repository with around 60,000 commits, perfrevset for gitnode becomes:
before: ! wall 1.130716 comb 1.130000 user 1.130000 sys 0.000000 (best of 9)
after: ! wall 0.178828 comb 0.180000 user 0.180000 sys 0.000000 (best of 54)
In reality, perfrevset doesn't clear the Git-to-Mercurial map, which means that
a call like `hg log -r 'gitnode(...)'` speeds up from around 1.5 seconds to
0.6.
author | Siddharth Agarwal <sid0@fb.com> |
---|---|
date | Mon, 14 Apr 2014 19:32:17 -0700 |
parents | 96458acb160a |
children | 5770a5a8bc00 |
files | hggit/__init__.py |
diffstat | 1 files changed, 3 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/hggit/__init__.py +++ b/hggit/__init__.py @@ -31,6 +31,7 @@ from mercurial import hg from mercurial import ignore from mercurial import localrepo +from mercurial.node import hex from mercurial import revset from mercurial import templatekw from mercurial import util as hgutil @@ -200,8 +201,9 @@ rev = revset.getstring(args[0], "the argument to gitnode() must be a hash") git = repo.githandler + node = repo.changelog.node def matches(r): - gitnode = git.map_git_get(repo[r].hex()) + gitnode = git.map_git_get(hex(node(r))) if gitnode is None: return False return rev in [gitnode, gitnode[:12]]