Ticket #2: viewmtn_shortchanges.diff

File viewmtn_shortchanges.diff, 4.2 KB (added by elb@…, 11 years ago)

short changes branch history view

  • handlers.py

    ============================================================
    class Changes(object):  
    215215        return rv
    216216   
    217217    def determine_bounds(self, from_change, to_change):
    218         per_page = 10
     218        per_page = 50
    219219        max_per_page = 100
    220220        if from_change: from_change = int(from_change)
    221221        else: from_change = 0
    class HTMLBranchChanges(Changes):  
    313313    def GET(self, ctxt, branch, from_change, to_change):
    314314        Changes.Branch_GET(self, ctxt, branch, from_change, to_change, "branchchanges.html")
    315315
     316class HTMLBranchShortChanges(Changes):
     317    def GET(self, ctxt, branch, from_change, to_change):
     318        Changes.Branch_GET(self, ctxt, branch, from_change, to_change, "branchshortchanges.html")
     319
    316320class RSSBranchChanges(Changes):
    317321    def GET(self, ctxt, branch, from_change, to_change):
    318322        Changes.Branch_GET(self, ctxt, branch, from_change, to_change, "branchchangesrss.html")
    class RobotsTxt(object):  
    797804                # the goal is just to let a robot trawl through the most recent changes, and deny access
    798805                # to expensive pointless things. We don't want a robot indexing every file in every revision,
    799806                # as this is an enormous amount of information.
    800                 for access_method in ['/revision/', '/branch/head/', '/branch/anyhead/', '/branch/changes/from/', '/json/', '/mimeicon/']:
     807                for access_method in ['/revision/', '/branch/head/', '/branch/anyhead/', '/branch/changes/from/', '/branch/shortchanges/from/', '/json/', '/mimeicon/']:
    801808                    disallow = access_method + revision_page
    802809                    if not dbname is None:
    803810                        disallow = '/' + dbname + disallow
  • links.py

    ============================================================
    class BranchLink(Link):  
    8888    def __init__(self, branch, **kwargs):
    8989        Link.__init__(*(self, ), **kwargs)
    9090        self.json_args = [branch.name]
     91        if kwargs.get('short_changes'):
     92            prefix = 'branch/shortchanges'
     93        else:
     94            prefix = 'branch/changes'
    9195        from_change, to_change = kwargs.get('from_change'), kwargs.get('to_change')
    9296        if from_change and to_change:
    93             self.relative_uri = 'branch/changes/%s/from/%d/to/%d' % (urllib.quote(branch.name, safe = ''), from_change, to_change)
     97            self.relative_uri = '%s/%s/from/%d/to/%d' % (prefix, urllib.quote(branch.name, safe = ''), from_change, to_change)
    9498        else:
    95             self.relative_uri = 'branch/changes/' + urllib.quote(branch.name, safe = '')
     99            self.relative_uri = '%s/%s' % (prefix, urllib.quote(branch.name, safe = ''))
    96100        self.description = hq(branch.name)
    97101
    98102class DiffLink(Link):
  • templates/branch.html

    ============================================================
     
    22
    33#def extramenu
    44<strong>Branch $branch.name</strong>:
     5<a href="$perdb_join('branch/shortchanges/%s' % $urllib_quote($branch.name, safe=''))">Concise Changes</a> |
    56<a href="$perdb_join('branch/changes/%s' % $urllib_quote($branch.name, safe=''))">Changes</a> |
    67<a href="$perdb_join('branch/head/info/%s' % $urllib_quote($branch.name, safe=''))">Head revision</a> |
    78<a href="$perdb_join('branch/tags/%s' % $urllib_quote($branch.name, safe=''))">Tags</a> |
  • urls.py

    ============================================================
    perdb_urls = (  
    5353
    5454    r'branch/changes/(.*)/from/(\d+)/to/(\d+)', 'HTMLBranchChanges',
    5555    r'branch/changes/([^/]+)()()', 'HTMLBranchChanges',
     56    r'branch/shortchanges/(.*)/from/(\d+)/to/(\d+)', 'HTMLBranchShortChanges',
     57    r'branch/shortchanges/([^/]+)()()', 'HTMLBranchShortChanges',
    5658    r'branch/changes/(.*)/from/(\d+)/to/(\d+)/rss', 'RSSBranchChanges',
    5759    r'branch/changes/([^/]+)()()/rss', 'RSSBranchChanges',
    5860    r'branch/tags/([^/]+)', 'Tags',