# # # patch "mtn_cvs/cvs_sync.cc" # from [ac7fc315a0b1b9abab8df8bdc0ba05f9f603fef5] # to [b1ae4ce73bf1290be9bd15795b3788e186b1cfa5] # # patch "mtn_cvs/cvs_sync.hh" # from [02ddaa333843077efbc0169196e919feecfa04c2] # to [350f3f5ea1300fbfb18cf8cb88c14ba179ce2d16] # # patch "mtn_cvs/options_list.hh" # from [364fd8dcbf1eb6313a23febe62d544a31240e75b] # to [85a2c2ed794980775702ce96e4a7f5def257a78c] # ============================================================ --- mtn_cvs/cvs_sync.cc ac7fc315a0b1b9abab8df8bdc0ba05f9f603fef5 +++ mtn_cvs/cvs_sync.cc b1ae4ce73bf1290be9bd15795b3788e186b1cfa5 @@ -110,19 +110,29 @@ std::string debug_manifest(const cvs_man return result; } +template <> void +static dump(cvs_sync::file_state const& fs, std::string& result) +{ + result="since "+cvs_repository::time_t2human(fs.since_when); + result+=" V"+fs.cvs_version+" "; + if (fs.dead) result+= "dead"; + else if (fs.size) result+= boost::lexical_cast(fs.size); + else if (fs.patchsize) result+= "p" + boost::lexical_cast(fs.patchsize); + else if (!fs.sha1sum().empty()) result+= fs.sha1sum().substr(0,4) + fs.keyword_substitution; + result+=" "+fs.log_msg.substr(0,20)+"\n"; +} + std::string cvs_repository::debug_file(std::string const& name) { std::map::const_iterator i=files.find(name); E(i!=files.end(),F("file '%s' not found\n") % name); std::string result; for (std::set::const_iterator j=i->second.known_states.begin(); j!=i->second.known_states.end();++j) - { result+="since "+time_t2human(j->since_when); - result+=" V"+j->cvs_version+" "; - if (j->dead) result+= "dead"; - else if (j->size) result+= boost::lexical_cast(j->size); - else if (j->patchsize) result+= "p" + boost::lexical_cast(j->patchsize); - else if (!j->sha1sum().empty()) result+= j->sha1sum().substr(0,4) + j->keyword_substitution; - result+=" "+j->log_msg.substr(0,20)+"\n"; + { + std::string part; + dump(*j, part); + result+=part; + result+='\n'; } return result; } @@ -173,6 +183,20 @@ mtn_automate::sync_map_t cvs_repository: return result; } +template <> void +static dump(cvs_sync::cvs_edge const& e, std::string& result) +{ result= "[" + cvs_repository::time_t2human(e.time); + if (e.time!=e.time2) result+= "+" + boost::lexical_cast(e.time2-e.time); + if (!e.revision().empty()) result+= "," + e.revision().substr(0,4); + if (!e.xfiles.empty()) + result+= "," + boost::lexical_cast(e.xfiles.size()) + + (e.delta_base.inner()().empty()?"files":"deltas"); + result+= "," + e.author + ","; + std::string::size_type nlpos=e.changelog.find_first_of("\n\r"); + if (nlpos>50) nlpos=50; + result+= e.changelog.substr(0,nlpos) + "]"; +} + std::string cvs_repository::debug() const { std::string result; @@ -180,16 +204,11 @@ std::string cvs_repository::debug() cons result+= "Edges :\n"; for (std::set::const_iterator i=edges.begin(); i!=edges.end();++i) - { result+= "[" + time_t2human(i->time); - if (i->time!=i->time2) result+= "+" + boost::lexical_cast(i->time2-i->time); - if (!i->revision().empty()) result+= "," + i->revision().substr(0,4); - if (!i->xfiles.empty()) - result+= "," + boost::lexical_cast(i->xfiles.size()) - + (i->delta_base.inner()().empty()?"files":"deltas"); - result+= "," + i->author + ","; - std::string::size_type nlpos=i->changelog.find_first_of("\n\r"); - if (nlpos>50) nlpos=50; - result+= i->changelog.substr(0,nlpos) + "]\n"; + { + std::string edge_part; + dump(*i, edge_part); + result+=edge_part; + result+='\n'; } result+= "Files :\n"; for (std::map::const_iterator i=files.begin(); @@ -524,7 +543,8 @@ void cvs_repository::fill_manifests(std: current_manifest=get_files(*before); } for (;e!=edges.end();++e) - { std::set::iterator next_edge=e; + { MM(*e); + std::set::iterator next_edge=e; ++next_edge; for (std::map::const_iterator f=files.begin();f!=files.end();++f) { I(!branch.empty() || !f->second.known_states.empty()); @@ -561,14 +581,17 @@ void cvs_repository::fill_manifests(std: } } else // file was present in last manifest, check whether next revision already fits - { cvs_file_state s=mi->second; + { + cvs_file_state s=mi->second; + MM(*s); ++s; if (s!=f->second.known_states.end() && (*s)<=(*e) && ( next_edge==edges.end() || ((*s)<(*next_edge)) ) ) { if (s->dead) current_manifest.erase(mi); else - { mi->second=s; + { + mi->second=s; I(!s->sha1sum().empty()); } check_split(s,f->second.known_states.end(),e); ============================================================ --- mtn_cvs/cvs_sync.hh 02ddaa333843077efbc0169196e919feecfa04c2 +++ mtn_cvs/cvs_sync.hh 350f3f5ea1300fbfb18cf8cb88c14ba179ce2d16 @@ -177,7 +177,6 @@ private: mtn_automate::cset &cs); mtn_automate::sync_map_t create_sync_state(cvs_edge const& e); - static std::string time_t2human(const time_t &t); public: // semi public interface for push/pull void prime(); void update(); @@ -189,6 +188,7 @@ public: // semi public interface for pus const cvs_manifest &get_files(const revision_id &e); static time_t posix2time_t(std::string s); + static std::string time_t2human(const time_t &t); void takeover(); std::string debug_file(std::string const& name); ============================================================ --- mtn_cvs/options_list.hh 364fd8dcbf1eb6313a23febe62d544a31240e75b +++ mtn_cvs/options_list.hh 85a2c2ed794980775702ce96e4a7f5def257a78c @@ -77,6 +77,42 @@ OPTION(globals, debug, false, "debug", } #endif +GOPT(quiet, "quiet", bool, false, + gettext_noop("suppress verbose, informational and progress messages")) +#ifdef option_bodies +{ + quiet = true; + global_sanity.set_quiet(); + ui.set_tick_writer(new tick_write_nothing); +} +#endif + +GOPT(reallyquiet, "reallyquiet", bool, false, +gettext_noop("suppress warning, verbose, informational and progress messages")) +#ifdef option_bodies +{ + reallyquiet = true; + global_sanity.set_reallyquiet(); + ui.set_tick_writer(new tick_write_nothing); +} +#endif + +GOPT(ticker, "ticker", std::string, , + gettext_noop("set ticker style (count|dot|none)")) +#ifdef option_bodies +{ + ticker = arg; + if (ticker == "none" || global_sanity.quiet) + ui.set_tick_writer(new tick_write_nothing); + else if (ticker == "dot") + ui.set_tick_writer(new tick_write_dot); + else if (ticker == "count") + ui.set_tick_writer(new tick_write_count); + else + throw bad_arg_internal(F("argument must be 'none', 'dot', or 'count'").str()); +} +#endif + GOPT(mtn_binary, "mtn", utf8, , gettext_noop("monotone binary name")) #ifdef option_bodies { @@ -99,6 +135,14 @@ OPTION(globals, mtn_option, true, "mtn-o } #endif +OPTION(globals, dump, true, "dump", + gettext_noop("file to dump debugging log to, on failure")) +#ifdef option_bodies +{ + global_sanity.filename = system_path(arg).as_external(); +} +#endif + #define TRANSOPT_sub(name,hasarg,optstring,desc) \ OPTION(globals,name,hasarg,optstring,desc) @@ -119,26 +163,16 @@ OPTION(globals, mtn_option, true, "mtn-o #endif // these options are passed transparently -TRANSOPT3(db, "db,d", N_("passed: database location")); -TRANSOPT(rcfile, N_("passed: config file")); -TRANSOPT_BOOL(nostd, N_("passed: do not read standard hooks")); -TRANSOPT(keydir, N_("passed: key directory")); -TRANSOPT3(key, "key,k", N_("passed: key")); -TRANSOPT_BOOL(norc, N_("passed: norc")); -TRANSOPT(root, N_("passed: root")); -TRANSOPT(confdir, N_("passed: confdir")); +TRANSOPT3(db, "db,d", N_("passed: set name of database")); +TRANSOPT(rcfile, N_("passed: load extra rc file")); +TRANSOPT_BOOL(nostd, N_("passed: do not load standard lua hooks")); +TRANSOPT(keydir, N_("passed: set location of key store")); +TRANSOPT3(key, "key,k", N_("passed: set key for signatures")); +TRANSOPT_BOOL(norc, N_("passed: do not load ~/.monotone/monotonerc or _MTN/monotonerc lua files")); +TRANSOPT(root, N_("passed: limit search for workspace to specified root")); +TRANSOPT(confdir, N_("passed: set location of configuration directory")); #undef TRANSOPT3 #undef TRANSOPT_BOOL #undef TRANSOPT -#if 0 -GOPT(db, "db,d", string, N_("passed: database location")); -GOPT(rcfile, "rcfile", string, N_("passed: config file")); -GOPT(nostd, "nostd", nil, N_("passed: do not read standard hooks")); -GOPT(keydir, "keydir", string, N_("passed: key directory")); -GOPT(key, "key,k", string, N_("passed: key")); -GOPT(norc, "norc", nil, N_("passed: norc")); -GOPT(root, "root", string, N_("passed: root")); -GOPT(confdir, "confdir", string, N_("passed: confdir")); -#endif