v0.2 Release – On Initial PageLoad show 20 entries instead of 10 for bug 459727

Currently if you have a look at the pushlog on the initial PageLoad only 10 entries are shown. I’ve decided that I want the pushlog to initially show 20 entries instead of 10. There are 2 reasons for this, let me explain:

  • OnScroll Event doesn’t fire- If the code there are only 10 entries initially, the OnScroll event doesn’t fire since there is no scroll bar present. By making the initial number of entries 20, the scroll bar appears. Now, when the user attempts to scroll down the OnScroll Event is able to fire appropriately (see the below)

  • 1
    $(window).scroll(function() {
      if($(window).scrollTop() == $(document).height() - $(window).height()) {

    renderMorePushLogResults(), which loads the new entries is fired when the user reaches the end of the page.

  • Maintaining Consistency – When the OnScroll event is fired (when the user reaches the end of the page) 20 more entries are loaded each time. To maintain consistency with this pattern the initial number of entries should also be the same number

The Code

To make this change I needed to make a couple of back-end changes to the pushlog-feed.py file. Thankfully, there wasn’t need to make any drastic changes. There is a global variable called PUSHES_PER_PAGE, which I set to 20. I also made the following change on line 144 in pushlogSetup()

e = getpushlogentries(conn, (page - 1) * PUSHES_PER_PAGE, 20, tipsonly)

That’s all the changes I needed to make to implement my change.

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

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>