v0.7 Release – Repeating Bug with Merge Changesets

As a part of one of my goals for the current release I’m diving into an apparent (yes, another one) bug with with merge changesets. Now, let it be known that I’m not totally sure whether this is a bug or not. This might not be my fault at all. It could just be that the data from the database is as such that repetitions are occuring. This is what I have to investigate.

Take a look at the screenshot below:

As you can see above, the entry after a merge changset is the same as one of the entries in the merge changeset itself. I’ve had a look at the data being passed from the server side. I’m printing the exact same data that I am receiving from the server side. The repetition is definitely not due to my code. The order, the number of entries printed etc are all correct.

On the server side, ctx.parents() contains merge changeset data. So if ctx.parents() is greater than 1 than there is merge data present, which I then retrieve and pass on to the client side to display. The following is the code I use:

def pushes_worker(query, repo):
    """Given a PushlogQuery, return a data structure mapping push IDs
    to a map of data about the push."""
    pushes = {}
    for id, user, date, node in query.entries:
        mergeData = []
        ctx = repo.changectx(node)
        if len(ctx.parents()) > 1:
          for cs in ctx.parents():
            mergeData.append(hex(cs.node()) + '|-|' + clean(person(cs.user())) + '|-|' + clean(cs.description()))
        if id in pushes:
            # we get the pushes in reverse order
            pushes[id]['changesets'].insert(0, node)
            pushes[id]['mergeData'].insert(0, mergeData)
            pushes[id] = {'user': user,
                          'date': date,
                          'changesets': [node],
                          'formattedDate': util.datestr(localdate(date)),
                          'individualChangeset': hex(ctx.node()),
                          'author': clean(person(ctx.user())),
                          'desc': clean(ctx.description()),
                          'mergeData': mergeData,
                          'id': id
    return pushes

As far as I know ctx.parents() is the only way to retrieve merge changeset data and all I’m doing is displaying the data exactly as I’m getting it. This doesn’t seem to be a bug from my side of things but obviously something is wrong here. Fact is, entries shouldn’t be repeating like they are at the moment. Maybe a problem with ctx.parents()? It definitely seems to be something on the server side that is causing the issue. This is something I’ll have to discuss with ted or djc. I’ll look to fix this issue in my next release.

This entry was posted in DPS911, Mercurial Project, Open Source and tagged , . Bookmark the permalink.

One Response to v0.7 Release – Repeating Bug with Merge Changesets

  1. Justin Wood (Callek) says:

    Without staring at code, it sounds like you should really be only showing what changesets are _pushed_. IE. the merge is also a changeset.

    If people need to see what the merge’s parents are they can click through to see the merge.

    So it sounds like what happens here is that you are displaying the merge’s parent(s) rather than the the push’s themselves.

    Realize that a merge will always have two parents, one of which is *very likely* to have been there from a previous push.

    In future I may have time to stare at this code with you and work out a solution if you don’t beat me to it.

Leave a Reply

Your email address will not be published. Required fields are marked *


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>