Changeset 1538


Ignore:
Timestamp:
Oct 7, 2012, 11:29:04 AM (9 years ago)
Author:
Peter Johansson
Message:

refs #334. implement --update also for directories. For Directories the 'revision: ' tag in html output reflects the lowest revision of the nodes (Directory and sub-nodes). Directory is not reprinted if this revision is at least last_changed_rev, in other words, there is no node by node comparison but a more easily implemented collective comparison. In case of homogenous revision (no mixtures) this is is the same thing.

Location:
trunk
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/Directory.cc

    r1523 r1538  
    144144
    145145
     146  svn_revnum_t Directory::revision_min(void) const
     147  {
     148    svn_revnum_t result = svn_info().rev();
     149    for (NodeConstIterator i=daughters_.begin(); i!=daughters_.end(); ++i)
     150      result = std::min(result, (*i)->revision_min());
     151    return result;
     152  }
     153
     154
    146155  void Directory::traverse(NodeVisitor& visitor)
    147156  {
  • trunk/lib/Directory.h

    r1515 r1538  
    9595
    9696    /**
     97       \return min of revision of this Directory and its sub-nodes
     98     */
     99    svn_revnum_t revision_min(void) const;
     100
     101    /**
    97102       Calls visitor.enter(*this). If enter returns true, daughter
    98103       nodes are traverses. Finally visitor visitor.leave(*this) i called.
  • trunk/lib/DirectoryPrinter.cc

    r1537 r1538  
    7474                                         const std::string& line_type) const
    7575  {
    76     assert(0 && "implement me, please!");
    77     return "";
     76    std::string outdir   = stats_type+"/"+user+"/" +line_type;
     77    if (node().local_path()!="")
     78      outdir   += "/"+node().local_path();
     79    return outdir+"/index.html";
    7880  }
    7981
     
    9193
    9294  void DirectoryPrinter::print_core(const std::string& stats_type,
    93                              const std::string& user,
    94                              const std::string& line_type,
    95                              const SVNlog& log) const
     95                                    const std::string& user,
     96                                    const std::string& line_type,
     97                                    const SVNlog& log) const
    9698  {
    9799    const Stats& stats = directory_.stats_[stats_type];
    98100    std::string imagedir = stats_type+"/"+"images/"+line_type;
    99     std::string outdir   = stats_type+"/"+user+"/" +line_type;
     101    std::string html_name = out_name(stats_type, user, line_type);
     102    std::string outdir   = directory_name(html_name);
    100103    if (node().local_path()!="") {
    101104      imagedir += "/"+node().local_path();
     
    105108    if (user=="all")
    106109      mkdir_p(imagedir);
    107     std::string html_name = outdir+"/index.html";
     110
    108111    std::ofstream os(html_name.c_str());
    109112    assert(os.good());
    110113    if (node().local_path().empty())
    111       print_header(os, node().name(), directory_.level_+3, user, line_type, "index.html",
    112                    stats_type);
     114      print_header(os, node().name(), directory_.level_+3, user, line_type,
     115                   "index.html", stats_type, node().revision_min());
    113116    else
    114117      print_header(os, node().name(), directory_.level_+3, user, line_type,
    115                    node().local_path()+"/index.html", stats_type);
     118                   node().local_path()+"/index.html", stats_type,
     119                   node().revision_min());
    116120    path_anchor(os);
    117121
  • trunk/lib/File.cc

    r1478 r1538  
    123123
    124124
     125  svn_revnum_t File::revision_min(void) const
     126  {
     127    return svn_info().rev();
     128  }
     129
     130
    125131  void File::traverse(NodeVisitor& visitor)
    126132  {
  • trunk/lib/File.h

    r1478 r1538  
    7777                                 svn_revnum_t ignore_rev);
    7878
     79    ///
     80    /// \return revision File
     81    ///
     82    svn_revnum_t revision_min(void) const;
     83
    7984    /**
    8085       Let the visitor perform its mission via visitor(*this)
  • trunk/lib/FilePrinter.cc

    r1537 r1538  
    191191    std::ofstream os(blame_output_file_name().c_str());
    192192    assert(os.good());
    193     print_html_start(os, "svndigest", file_.level_+1,file_.last_changed_rev());
     193    print_html_start(os, "svndigest", file_.level_+1,file_.revision_min());
    194194    print_blame(os);
    195195    print_footer(os);
     
    213213    assert(os);
    214214    print_header(os, node().name(), file_.level_+3, user, line_type,
    215                  lpath+".html", stats_type, file_.last_changed_rev());
     215                 lpath+".html", stats_type, file_.revision_min());
    216216    path_anchor(os);
    217217
  • trunk/lib/Node.h

    r1515 r1538  
    141141     */
    142142    const SVNproperty& property(void) const;
     143
     144    /**
     145       check revision of this node and sub-nodes and return the
     146       smallest revision, i.e., all nodes are at least at revision
     147       returned.
     148     */
     149    virtual svn_revnum_t revision_min(void) const=0;
    143150
    144151    /**
  • trunk/lib/NodePrinter.cc

    r1537 r1538  
    114114      return;
    115115    if (update && output_revision() >= node().last_changed_rev())
    116         return;
     116      return;
    117117    if (verbose)
    118118      std::cout << "Printing output for '" << node().path_ << "'" << std::endl;
  • trunk/lib/SvndigestVisitor.cc

    r1537 r1538  
    6161      dir.init_tiny_stats();
    6262      DirectoryPrinter dp(dir);
    63       dp.print(verbose_);
     63      dp.print(verbose_, update_);
    6464    }
    6565  }
  • trunk/test/Makefile.am

    r1536 r1538  
    6666
    6767# tests not yet passing are listed here
    68 XFAIL_TESTS = test/update_test.sh
     68XFAIL_TESTS =
    6969
    7070noinst_HEADERS += test/Suite.h
  • trunk/test/update_test.sh

    r1537 r1538  
    3636| grep 'revision:' || exit_fail
    3737
     38head $targetdir/toy_project/classic/all/total/index.html \
     39| grep 'revision:' || exit_fail
     40
     41head $targetdir/toy_project/classic/all/total/bin/index.html \
     42| grep 'revision:' || exit_fail
     43
    3844# update to latest rev
    3945$SVN update -r 71 $rootdir/lib
Note: See TracChangeset for help on using the changeset viewer.