Edgewall Software

Opened 9 years ago

Closed 9 years ago

#11979 closed defect (fixed)

Limit parameter in log view has off-by-one error — at Version 2

Reported by: Jun Omae Owned by: Jun Omae
Priority: normal Milestone: 1.0.6
Component: version control/log view Version: 0.12-stable
Severity: minor Keywords:
Cc: Branch:
Release Notes:

Fix off-by-one error in limit parameter of log view when no history remaining.

API Changes:
Internal Changes:

Description

log:?rev=10 shows 10 commits but log:?rev=10&limit=10 shows 9 commits. The limit parameter has off-by-one error.

  • trac/versioncontrol/web_ui/log.py

    diff --git a/trac/versioncontrol/web_ui/log.py b/trac/versioncontrol/web_ui/log.py
    index 9e4d3cc..ed4e910 100644
    a b class LogModule(Component):  
    256256                           '%(rev)s)', path=next_path,
    257257                           rev=display_rev(next_rev)))
    258258            # only show fully 'limit' results, use `change == None` as a marker
    259             info[-1]['change'] = None
     259            if count > limit:
     260                info[-1]['change'] = None
    260261
    261262        revisions = [i['rev'] for i in info]
    262263        changes = get_changes(repos, revisions, self.log)

I'll push it with unit tests later.

Change History (2)

comment:1 by Jun Omae, 9 years ago

Owner: set to Jun Omae
Status: newassigned

The below patch is incomplete. Reworked and proposed changes in jomae.git@t11979.

comment:2 by Jun Omae, 9 years ago

Release Notes: modified (diff)
Resolution: fixed
Status: assignedclosed

Committed in [13917] and merged to trunk in [13918].

Note: See TracTickets for help on using tickets.