Changeset 768 for trunk/lib/Trac.cc


Ignore:
Timestamp:
Jan 31, 2009, 10:30:37 PM (12 years ago)
Author:
Peter Johansson
Message:

Merged patch release 0.6.7 to trunk. Delta 0.6.7 - 0.6.6

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/Trac.cc

    r693 r768  
    33/*
    44  Copyright (C) 2007 Jari Häkkinen, Peter Johansson
     5  Copyright (C) 2008, 2009 Peter Johansson
    56
    67  This file is part of svndigest, http://dev.thep.lu.se/svndigest
     
    4849
    4950
    50   bool Trac::changeset(std::string::const_iterator& first,
     51  bool Trac::changeset(const std::string::const_iterator& first,
     52                       std::string::const_iterator& iter,
    5153                       const std::string::const_iterator& last,
    5254                       const std::string::const_iterator& last_trunc)
    5355  {
    54     if (changeset1(first, last, last_trunc))
    55       return true;
    56     if (changeset2(first, last, last_trunc))
    57       return true;
    58     if (changeset3(first, last, last_trunc))
     56    if (changeset1(first, iter, last, last_trunc))
     57      return true;
     58    if (changeset2(iter, last, last_trunc))
     59      return true;
     60    if (changeset3(iter, last, last_trunc))
    5961      return true;
    6062    return false;
     
    6264
    6365
    64   bool Trac::changeset1(std::string::const_iterator& first,
     66  bool Trac::changeset1(const std::string::const_iterator& first,
     67                        std::string::const_iterator& iter,
    6568                        const std::string::const_iterator& last,
    6669                        const std::string::const_iterator& last_trunc)
    6770  {
    68     if (first==last)
    69       return false;
    70     if (*first != 'r')
    71       return false;
    72     const std::string::const_iterator first_orig(first);
    73     ++first;
    74     std::string rev = match(first, last, Digit());
    75     if (rev.empty()){
    76       first = first_orig;
     71    if (iter==last)
     72      return false;
     73    if (*iter != 'r')
     74      return false;
     75    if (iter!=first && isalnum(*(iter-1)))
     76      return false;
     77    const std::string::const_iterator iter_orig(iter);
     78    ++iter;
     79    std::string rev = match(iter, last, Digit());
     80    if (rev.empty() || (iter!=last && (std::isalnum(*iter) || *iter==':')) ){
     81      iter = iter_orig;
    7782      return false;
    7883    }
    7984    std::string href(Configuration::instance().trac_root()+"changeset/"+rev);
    80     hs_.stream() << anchor(href, anchor_text(first_orig, first, last_trunc));
     85    hs_.stream() << anchor(href, anchor_text(iter_orig, iter, last_trunc));
    8186    return true;
    8287  }
     
    288293
    289294
    290   bool Trac::log(std::string::const_iterator& first,
     295  bool Trac::log(const std::string::const_iterator& first,
     296                 std::string::const_iterator& iter,
    291297                 const std::string::const_iterator& last,
    292298                 const std::string::const_iterator& last_trunc)
    293299  {
    294     if (log1(first, last, last_trunc))
    295       return true;
    296     if (log2(first, last, last_trunc))
    297       return true;
    298     if (log3(first, last, last_trunc))
     300    if (log1(first, iter, last, last_trunc))
     301      return true;
     302    if (log2(iter, last, last_trunc))
     303      return true;
     304    if (log3(iter, last, last_trunc))
    299305      return true;
    300306    return false;
     
    302308
    303309
    304   bool Trac::log1(std::string::const_iterator& first,
     310  bool Trac::log1(const std::string::const_iterator& first,
     311                  std::string::const_iterator& iter,
    305312                  const std::string::const_iterator& last,
    306313                  const std::string::const_iterator& last_trunc)
    307314  {
    308     if (first==last)
    309       return false;
    310 
    311     const std::string::const_iterator first_orig(first);
    312     if (*first != 'r')
    313       return false;
    314     ++first;
    315 
    316     std::string stop_rev = match(first, last, AlNum());
    317     if (stop_rev.empty() || first == last || *first != ':') {
    318       first = first_orig;
    319       return false;
    320     }
    321     ++first;
    322     std::string rev = match(first, last, AlNum());
    323     if (rev.empty() ) {
    324       first = first_orig;
     315    if (iter==last)
     316      return false;
     317
     318    const std::string::const_iterator iter_orig(iter);
     319    if (*iter != 'r')
     320      return false;
     321    if (iter!=first && isalnum(*(iter-1)))
     322      return false;
     323    ++iter;
     324
     325    std::string stop_rev = match(iter, last, Digit());
     326    if (stop_rev.empty() || iter == last || *iter != ':') {
     327      iter = iter_orig;
     328      return false;
     329    }
     330    ++iter;
     331    std::string rev = match(iter, last, Digit());
     332    if (rev.empty() || (iter!=last && std::isalnum(*iter) ) ){
     333      iter = iter_orig;
    325334      return false;
    326335    }
    327336    std::string href(Configuration::instance().trac_root()+"log/?rev="+
    328337                     rev+"&amp;stop_rev="+stop_rev);
    329     hs_.stream() << anchor(href, anchor_text(first_orig,first, last_trunc));
     338    hs_.stream() << anchor(href, anchor_text(iter_orig,iter, last_trunc));
    330339    return true;
    331340  }
     
    445454      last_trunc = first+width;
    446455    while (first<last_trunc) {
    447       if (log(first, str.end(), last_trunc))
     456      if (log(str.begin(), first, str.end(), last_trunc))
    448457        continue;
    449458      if (comment(first, str.end(), last_trunc))
     
    451460      if (ticket(first, str.end(), last_trunc))
    452461        continue;
    453       if (changeset(first, str.end(), last_trunc))
     462      if (changeset(str.begin(), first, str.end(), last_trunc))
    454463        continue;
    455464      if (diff(first, str.end(), last_trunc))
Note: See TracChangeset for help on using the changeset viewer.