Skip to content

Fix TypeError caused by the `ngtip` revset returning a node instead of a rev

MR moved to !266 (merged)

See https://bz.mercurial-scm.org/show_bug.cgi?id=6405

How to trigger the error

The error was triggered by running

hg log -r 'ngtip("default")'

in a repository with more than one changeset. When the flow of control reached reachableroots2, it raised

TypeError: an integer is required (got type bytes)

See the Bugzilla link above for a full traceback.

Error cause investigation

That node hash (of type bytes) got added to the revlog earlier, by the topic extension's revset.py:ngtipset function (in evolve source /hgext3rd/topic/revset.py). The call stack from there proceeds thus:

Mercurial calls (in an example repo with two commits)

hgext_topic.revset.ngtipset(
    repo,
    subset=<fullreposet+ 0:2>,
    x=('symbol', 'default')
)

which calls hgext_topic.destination.ngtip, which calls hgext_topic.topicmap.branchtip, which calls mercurial.branchmap.branchtip which returns a node hash.

Open questions for this Merge Request

Question is: At what point in the call stack above should the node hash be turned into a rev number? The current patch chooses revset.py:ngtipset.

  • I'm certain revset.ngtipset should add a rev number to the changeset, not a node hash
  • I'm not certain what callers of destination.ngtip expect it to return.
Edited by Raphaël Gomès

Merge request reports

Loading