--- a/hgext/pushlog/__init__.py
+++ b/hgext/pushlog/__init__.py
@@ -633,35 +633,37 @@ def revset_pushhead(repo, subset, x):
revset.getargs(x, 0, 0, 'pushhead takes no arguments')
# Iterating over all pushlog data is unfortunate, as there is overhead
# involved. However, this is less overhead than issuing a SQL query for
# every changeset, especially on large repositories. There is room to make
# this optimal by batching SQL, but that adds complexity. For now,
# simplicity wins.
def getrevs():
+ to_rev = repo.changelog.rev
for push in repo.pushlog.pushes():
- yield repo[push.nodes[-1]].rev()
+ yield to_rev(bin(push.nodes[-1]))
return subset & revset.generatorset(getrevs())
@revsetpredicate('pushdate(interval)', safe=True)
def revset_pushdate(repo, subset, x):
"""Changesets that were pushed within the interval, see :hg:`help dates`."""
l = revset.getargs(x, 1, 1, 'pushdate requires one argument')
ds = revset.getstring(l[0], 'pushdate requires a string argument')
dm = util.matchdate(ds)
def getrevs():
+ to_rev = repo.changelog.rev
for push in repo.pushlog.pushes():
if dm(push.when):
for node in push.nodes:
- yield repo[node].rev()
+ yield to_rev(bin(node))
return subset & revset.generatorset(getrevs())
@revsetpredicate('pushuser(string)', safe=True)
def revset_pushuser(repo, subset, x):
"""User name that pushed the changeset contains string.
@@ -671,20 +673,21 @@ def revset_pushuser(repo, subset, x):
a regular expression. To match a user that actually contains `re:`, use
the prefix `literal:`.
"""
l = revset.getargs(x, 1, 1, 'pushuser requires one argument')
n = encoding.lower(revset.getstring(l[0], 'pushuser requires a string'))
kind, pattern, matcher = revset._substringmatcher(n)
def getrevs():
+ to_rev = repo.changelog.rev
for push in repo.pushlog.pushes():
if matcher(encoding.lower(push.user)):
for node in push.nodes:
- yield repo[node].rev()
+ yield to_rev(bin(node))
return subset & revset.generatorset(getrevs())
@revsetpredicate('pushid(int)', safe=True)
def revset_pushid(repo, subset, x):
"""Changesets that were part of the specified numeric push id."""
l = revset.getargs(x, 1, 1, 'pushid requires one argument')
@@ -694,39 +697,41 @@ def revset_pushid(repo, subset, x):
raise error.ParseError('pushid expects a number')
with repo.pushlog.conn(readonly=True) as conn:
push = repo.pushlog.pushfromid(conn, pushid) if conn else None
if not push:
return revset.baseset()
+ to_rev = repo.changelog.rev
pushrevs = set()
for node in push.nodes:
try:
- pushrevs.add(repo[node].rev())
+ pushrevs.add(to_rev(bin(node)))
except RepoLookupError:
pass
return subset & pushrevs
@revsetpredicate('pushrev(set)', safe=True)
def revset_pushrev(repo, subset, x):
"""Changesets that were part of the same push as the specified changeset(s)."""
l = revset.getset(repo, subset, x)
# This isn't the most optimal implementation, especially if the input
# set is large. But it gets the job done.
+ to_rev = repo.changelog.rev
revs = set()
for rev in l:
push = repo.pushlog.pushfromchangeset(repo[rev])
if push:
for node in push.nodes:
- revs.add(repo[node].rev())
+ revs.add(to_rev(bin(node)))
return subset.filter(revs.__contains__)
# Again, for performance reasons we read the entire pushlog database and cache
# the results. Again, this is unfortunate. But, the alternative is a potential
# very expensive series of database lookups.
#
# The justification for doing this for templates is even less than doing it for