Mercurial > hg > hg-git
changeset 938:d46938925708
revsets: use baseset instead of raw list
We fallback to using a standard set if baseset is not available
author | Sean Farley <sean@farley.io> |
---|---|
date | Thu, 24 Sep 2015 16:54:47 -0700 |
parents | f05962b0e78a |
children | e1117014036c |
files | hggit/__init__.py |
diffstat | 1 files changed, 11 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/hggit/__init__.py +++ b/hggit/__init__.py @@ -62,6 +62,14 @@ # The ignore module disappeared in Mercurial 3.5 ignoremod = False +baseset = set +try: + baseset = revset.baseset +except AttributeError: + # baseset was added in hg 3.0 + pass + + demandimport.ignore.extend([ 'collections', ]) @@ -338,7 +346,8 @@ revset.getargs(x, 0, 0, "fromgit takes no arguments") git = repo.githandler node = repo.changelog.node - return [r for r in subset if git.map_git_get(hex(node(r))) is not None] + return baseset(r for r in subset + if git.map_git_get(hex(node(r))) is not None) def revset_gitnode(repo, subset, x): '''``gitnode(hash)`` @@ -355,7 +364,7 @@ if gitnode is None: return False return rev in [gitnode, gitnode[:12]] - return [r for r in subset if matches(r)] + return baseset(r for r in subset if matches(r)) def gitnodekw(**args): """:gitnode: String. The Git changeset identification hash, as a 40 hexadecimal digit string."""