Changeset 293


Ignore:
Timestamp:
May 8, 2007, 6:02:12 PM (16 years ago)
Author:
Peter Johansson
Message:

refs #180 support r288:293 [288:293] log:@288:293.

Location:
trunk/lib
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/Trac.cc

    r292 r293  
    224224                 const std::string::const_iterator& last)
    225225  {
     226    if (log1(first, last))
     227      return true;
     228    if (log2(first, last))
     229      return true;
     230    if (log3(first, last))
     231      return true;
     232    return false;
     233  }
     234
     235
     236  bool Trac::log1(std::string::const_iterator& first,
     237                     const std::string::const_iterator& last)
     238  {
     239    if (first==last)
     240      return false;
     241
     242    const std::string::const_iterator first_orig(first);
     243    if (*first != 'r')
     244      return false;
     245    ++first;
     246
     247    std::string stop_rev = match(first, last, Digit());
     248    if (stop_rev.empty() || first == last || *first != ':') {
     249      first = first_orig;
     250      return false;
     251    }
     252    ++first;
     253    std::string rev = match(first, last, Digit());
     254    if (rev.empty() ) {
     255      first = first_orig;
     256      return false;
     257    }
     258    std::string href(Configuration::instance().trac_root()+"log/?rev="+
     259                     rev+"&stop_rev="+stop_rev);
     260    hs_.stream() << anchor(href, std::string(first_orig, first));
     261    return true;
     262  }
     263
     264
     265  bool Trac::log2(std::string::const_iterator& first,
     266                     const std::string::const_iterator& last)
     267  {
     268    if (first==last)
     269      return false;
     270
     271    const std::string::const_iterator first_orig(first);
     272    if (*first != '[')
     273      return false;
     274    ++first;
     275
     276    std::string stop_rev = match(first, last, Digit());
     277    if (stop_rev.empty() || first == last || *first != ':') {
     278      first = first_orig;
     279      return false;
     280    }
     281    ++first;
     282    std::string rev = match(first, last, Digit());
     283    if (rev.empty() || first == last || *first != ']') {
     284      first = first_orig;
     285      return false;
     286    }
     287    std::string href(Configuration::instance().trac_root()+"log/?rev="+
     288                     rev+"&stop_rev="+stop_rev);
     289    hs_.stream() << anchor(href, std::string(first_orig, first));
     290    return true;
     291  }
     292
     293
     294  bool Trac::log3(std::string::const_iterator& first,
     295                  const std::string::const_iterator& last)
     296  {
    226297    if (first==last)
    227298      return false;
     
    248319      return false;
    249320    }
    250     std::string href(Configuration::instance().trac_root()+"log"+node+
    251                      "?rev="+rev+"&stop_rev="+stop_rev);
    252     std::string str(first_orig, first);
    253     hs_.stream() << anchor(href, str);
     321    std::string href;
     322    if (!node.empty() && node[0]=='/')
     323      href = std::string(Configuration::instance().trac_root()+"log"+node+
     324                         "?rev="+rev+"&stop_rev="+stop_rev);
     325    else
     326      href = std::string(Configuration::instance().trac_root()+"log/"+node+
     327                         "?rev="+rev+"&stop_rev="+stop_rev);
     328     
     329    hs_.stream() << anchor(href, std::string(first_orig, first));
    254330    return true;
    255331  }
  • trunk/lib/Trac.h

    r292 r293  
    6868             const std::string::const_iterator& last);
    6969
     70    bool log1(std::string::const_iterator& first,
     71              const std::string::const_iterator& last);
     72
     73    bool log2(std::string::const_iterator& first,
     74              const std::string::const_iterator& last);
     75
     76    bool log3(std::string::const_iterator& first,
     77              const std::string::const_iterator& last);
     78
    7079    bool milestone(std::string::const_iterator& first,
    7180                   const std::string::const_iterator& last);
Note: See TracChangeset for help on using the changeset viewer.