diff --git a/rhodecode/config/routing.py b/rhodecode/config/routing.py --- a/rhodecode/config/routing.py +++ b/rhodecode/config/routing.py @@ -437,8 +437,8 @@ def make_map(config): '/{repo_name:.*}/compare/{org_ref_type}@{org_ref}...{other_ref_type}@{other_ref}', controller='compare', action='index', conditions=dict(function=check_repo), - requirements=dict(org_ref_type='(branch|book|tag)', - other_ref_type='(branch|book|tag)')) + requirements=dict(org_ref_type='(branch|book|tag|rev)', + other_ref_type='(branch|book|tag|rev)')) rmap.connect('pullrequest_home', '/{repo_name:.*}/pull-request/new', controller='pullrequests', diff --git a/rhodecode/model/pull_request.py b/rhodecode/model/pull_request.py --- a/rhodecode/model/pull_request.py +++ b/rhodecode/model/pull_request.py @@ -161,8 +161,20 @@ class PullRequestModel(BaseModel): for cs in reversed(map(binascii.hexlify, revs)): changesets.append(org_repo.get_changeset(cs)) else: - revs = ['ancestors(%s) and not ancestors(%s)' % (org_ref[1], - other_ref[1])] + _revset_predicates = { + 'branch': 'branch', + 'book': 'bookmark', + 'tag': 'tag', + 'rev': 'id', + } + + revs = [ + "ancestors(%s('%s')) and not ancestors(%s('%s'))" % ( + _revset_predicates[org_ref[0]], org_ref[1], + _revset_predicates[other_ref[0]], other_ref[1] + ) + ] + from mercurial import scmutil out = scmutil.revrange(org_repo._repo, revs) for cs in reversed(out):