Issue #7127 resolved

POST service orders commits backwards (BB-8235)

Martin Geisler
created an issue

I believe this changed recently, i.e., today: the list of commits in the JSON sent by the POST service is backwards with the oldest commit first, and the newest commit last.

I setup a test repository to verify this and posted to a postbin service. The JSON posted looks like this:

>>> pprint(json.loads(payload))
{u'canon_url': u'',
 u'commits': [{u'author': u'mg',
               u'branch': u'default',
               u'files': [{u'file': u'a.txt', u'type': u'modified'}],
               u'message': u'second',
               u'node': u'bb432135bdb5',
               u'parents': [u'34fb7a4e134a'],
               u'raw_author': u'Martin Geisler <>',
               u'raw_node': u'bb432135bdb590104d01c108ea6e4d26c90b3dd9',
               u'revision': 1,
               u'size': -1,
               u'timestamp': u'2013-04-19 17:43:23',
               u'utctimestamp': u'2013-04-19 15:43:23+00:00'},
              {u'author': u'mg',
               u'branch': u'default',
               u'files': [{u'file': u'a.txt', u'type': u'added'}],
               u'message': u'first',
               u'node': u'34fb7a4e134a',
               u'parents': [],
               u'raw_author': u'Martin Geisler <>',
               u'raw_node': u'34fb7a4e134a49ede8516c798b1ba807980d9ced',
               u'revision': 0,
               u'size': -1,
               u'timestamp': u'2013-04-19 17:43:17',
               u'utctimestamp': u'2013-04-19 15:43:17+00:00'}],
 u'repository': {u'absolute_url': u'/mg/post-test/',
                 u'fork': False,
                 u'is_private': False,
                 u'name': u'post-test',
                 u'owner': u'mg',
                 u'scm': u'hg',
                 u'slug': u'post-test',
                 u'website': u''},
 u'truncated': False,
 u'user': u'mg'}

This confuses my Buildbot: it sees the changes and thinks the last commit (really the first) is the one it should build. It builds this commit and fails to build the following commits.

Comments (8)

  1. Erik van Zijst staff

    Martin Geisler I just had a look at the code and I'm not sure I understand what you mean. You say that POST now includes "the oldest commit first, and the newest commit last.", but your output seems to do the reverse (the most recent commit is the first in the list, followed by the older, parent commit).

  2. Martin Geisler reporter

    Hey Erik van Zijst , thanks for looking at this! I formulated myself badly in the first paragraph...

    Before, when I pushed changesets X, Y, and Z, with X being the oldest and Z the newest, then the POST data would contain

    commits: [X, Y, Z],

    It now contains

    commits: [Z, Y, X]


    In my test repository you see the commits listed in the payload as

    commits: [{..., message: "second", ..., revision: 1, ...},
              {..., message: "first", ...,  revision: 0, ...}]

    where the commit messages correspond to the first and second commit, respectively. I hope it's more clear now.

  3. Log in to comment