#
#
# patch "mtn_cvs/mtn_cvs.cc"
# from [cba272faed07c62c7432c3caf15f016274def2ac]
# to [5703c6c737b175048c78dd53213e3615bc1e4b24]
#
# patch "mtn_cvs/options.cc"
# from [e89af04e97c53b86bbfff144e567a6bfd7535357]
# to [3fd2f0ffb4e8d250dc905a4461c1cdf43df0a88d]
#
# patch "mtn_cvs/options.hh"
# from [c3d069fcf7845b6e8cf8a2819d73e98c69aaee8b]
# to [7bcd146217355875a516967d93b97f7f7a4db2a3]
#
# patch "mtn_cvs/options_list.hh"
# from [a0c250180df7dd9509af7f0b036bad0e3eb93661]
# to [b6d15c7c603036782d9a0eaa341c9cff02fdc5f3]
#
============================================================
--- mtn_cvs/mtn_cvs.cc cba272faed07c62c7432c3caf15f016274def2ac
+++ mtn_cvs/mtn_cvs.cc 5703c6c737b175048c78dd53213e3615bc1e4b24
@@ -204,21 +204,6 @@ using boost::shared_ptr;
using std::ios_base;
using boost::shared_ptr;
-// This is in a sepaarte procedure so it can be called from code that's called
-// before cpp_main(), such as program option object creation code. It's made
-// so it can be called multiple times as well.
-void localize_monotone()
-{
- static int init = 0;
- if (!init)
- {
- setlocale(LC_ALL, "");
-// bindtextdomain(PACKAGE, LOCALEDIR);
-// textdomain(PACKAGE);
- init = 1;
- }
-}
-
// define the global objects needed by botan_pipe_cache.hh
pipe_cache_cleanup * global_pipe_cleanup_object;
Botan::Pipe * unfiltered_pipe;
@@ -267,6 +252,13 @@ commands::command_id read_options(optio
return cmd;
}
+void
+mtn_terminate_handler()
+{
+ ui.fatal(F("std::terminate() - exception thrown while handling another exception"));
+ exit(3);
+}
+
int
cpp_main(int argc, char ** argv)
{
@@ -275,12 +267,16 @@ cpp_main(int argc, char ** argv)
// atexit(&dumper);
// go-go gadget i18n
- localize_monotone();
+ setlocale(LC_ALL, "");
+ bindtextdomain(PACKAGE, get_locale_dir().c_str());
+ textdomain(PACKAGE);
// set up global ui object - must occur before anything that might try to
// issue a diagnostic
ui_library acquire_ui;
+ std::set_terminate(&mtn_terminate_handler);
+
// we want to catch any early informative_failures due to charset
// conversion etc
try
@@ -313,6 +309,38 @@ cpp_main(int argc, char ** argv)
args.push_back(arg_type(ut));
}
+ // check the botan library version we got linked against.
+ u32 linked_botan_version = BOTAN_VERSION_CODE_FOR(
+ Botan::version_major(), Botan::version_minor(),
+ Botan::version_patch());
+
+ // Botan 1.7.14 has an incompatible API change, which got reverted
+ // again in 1.7.15. Thus we do not care to support 1.7.14.
+ E(linked_botan_version != BOTAN_VERSION_CODE_FOR(1,7,14), origin::system,
+ F("Monotone does not support Botan 1.7.14."));
+
+#if BOTAN_VERSION_CODE <= BOTAN_VERSION_CODE_FOR(1,7,6)
+ E(linked_botan_version >= BOTAN_VERSION_CODE_FOR(1,6,3), origin::system,
+ F("This monotone binary requires Botan 1.6.3 or newer."));
+ E(linked_botan_version <= BOTAN_VERSION_CODE_FOR(1,7,6), origin::system,
+ F("This monotone binary does not work with Botan newer than 1.7.6."));
+#elif BOTAN_VERSION_CODE <= BOTAN_VERSION_CODE_FOR(1,7,22)
+ E(linked_botan_version > BOTAN_VERSION_CODE_FOR(1,7,6), origin::system,
+ F("This monotone binary requires Botan 1.7.7 or newer."));
+ // While compiling against 1.7.22 or newer is recommended, because
+ // it enables new features of Botan, the monotone binary compiled
+ // against Botan 1.7.21 and before should still work with newer Botan
+ // versions, including all of the stable branch 1.8.x.
+ E(linked_botan_version < BOTAN_VERSION_CODE_FOR(1,9,0), origin::system,
+ F("This monotone binary does not work with Botan 1.9.x."));
+#else
+ E(linked_botan_version > BOTAN_VERSION_CODE_FOR(1,7,22), origin::system,
+ F("This monotone binary requires Botan 1.7.22 or newer."));
+ E(linked_botan_version < BOTAN_VERSION_CODE_FOR(1,9,0), origin::system,
+ F("This monotone binary does not work with Botan 1.9.x."));
+#endif
+
+#if 0
// find base name of executable, convert to utf8, and save it in the
// global ui object
{
@@ -324,6 +352,7 @@ cpp_main(int argc, char ** argv)
ui.prog_name = prog_name;
I(!ui.prog_name.empty());
}
+#endif
mtncvs_state app;
try
@@ -374,10 +403,6 @@ cpp_main(int argc, char ** argv)
return 0;
}
}
- catch (option::option_error const & e)
- {
- E(false, origin::user, i18n_format("%s") % e.what());
- }
catch (usage & u)
{
// we send --help output to stdout, so that "mtn --help | less" works
@@ -411,6 +436,10 @@ cpp_main(int argc, char ** argv)
}
}
+ catch (option::option_error const & e)
+ {
+ E(false, origin::user, i18n_format("%s") % e.what());
+ }
catch (recoverable_failure & inf)
{
ui.inform(inf.what());
@@ -450,20 +479,3 @@ cpp_main(int argc, char ** argv)
return 3;
}
-#if 0
-int
-main(int argc, char **argv)
-{
- try
- {
-// ui.set_prog_name("mtn_cvs");
- return cpp_main(argc,argv);
-// return main_with_many_flavours_of_exception(argc, argv);
- }
- catch (std::exception const & e)
- {
- ui.fatal(string(e.what()) + "\n");
- return 3;
- }
-}
-#endif
============================================================
--- mtn_cvs/options.cc e89af04e97c53b86bbfff144e567a6bfd7535357
+++ mtn_cvs/options.cc 3fd2f0ffb4e8d250dc905a4461c1cdf43df0a88d
@@ -1,5 +1,11 @@
-// Copyright 2006 Timothy Brownawell
-// This is made available under the GNU GPL v2 or later.
+// Copyright (C) 2006 Timothy Brownawell
+//
+// This program is made available under the GNU GPL version 2.0 or
+// greater. See the accompanying file COPYING for details.
+//
+// This program is distributed WITHOUT ANY WARRANTY; without even the
+// implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+// PURPOSE.
#include "base.hh"
#include
@@ -81,9 +87,9 @@ options::options()
options::options()
{
# define OPTSET(name)
-# define OPTVAR(group, type, name, default_) \
+# define OPTVAR(group, type, name, default_) \
name = type ( default_ );
-# define OPTION(optset, name, hasarg, optstring, description) \
+# define OPTION(optset, name, hasarg, optstring, description) \
name ## _given = false;
# define OPTSET_REL(parent, child)
@@ -95,6 +101,26 @@ options::options()
# undef OPTSET_REL
}
+const options &
+options::operator = (options const & other)
+{
+# define OPTSET(name)
+# define OPTVAR(group, type, name, default_) \
+ name = other.name;
+# define OPTION(optset, name, hasarg, optstring, description) \
+ name ## _given = other.name ## _given;
+# define OPTSET_REL(parent, child)
+
+# include "options_list.hh"
+
+# undef OPTSET
+# undef OPTVAR
+# undef OPTION
+# undef OPTSET_REL
+
+ return *this;
+}
+
static options::options_type
collect_children(options::static_options_fun opt)
{
@@ -104,7 +130,7 @@ collect_children(options::static_options
i != ch.end(); ++i)
{
if (*i != opt)
- out = out | (*(*i))();
+ out = out | (*(*i))();
}
return out;
}
@@ -132,46 +158,44 @@ options::options_type const & options::o
}
# define OPTSET(name) \
- options::options_type const & options::opts::name() \
- { \
- static options::options_type val = \
- collect_children(&options::opts::name) \
+ options::options_type const & options::opts::name() \
+ { \
+ static options::options_type val = \
+ collect_children(&options::opts::name) \
| options::option_type("", #name, false, 0, \
- &options::reset_optset_ ## name ); \
- return val; \
- } \
- void options::reset_optset_ ## name () \
- { \
- reset_optset(&opts:: name); \
+ &options::reset_optset_ ## name ); \
+ return val; \
+ } \
+ void options::reset_optset_ ## name () \
+ { \
+ reset_optset(&opts:: name); \
}
-# define OPTVAR(optset, type, name, default_) \
- void options::reset_ ## name () \
- { \
- name = type ( default_ ); \
+# define OPTVAR(optset, type, name, default_) \
+ void options::reset_ ## name () \
+ { \
+ name = type ( default_ ); \
}
-# define OPTION(optset, name, hasarg, optstring, description) \
- options::options_type const & options::opts::name() \
- { \
- localize_monotone(); \
- \
- static options::options_type val(optstring, \
- gettext(description), hasarg, \
- &options::set_ ## name , \
- &options::reset_opt_ ## name ); \
- return val; \
- } \
- void options::reset_opt_ ## name () \
- { \
- name ## _given = false; \
- reset_optset(&opts:: name); \
- } \
- void options::set_ ## name (std::string arg) \
- { \
- name ## _given = true; \
- real_set_ ## name (arg); \
- } \
+# define OPTION(optset, name, hasarg, optstring, description) \
+ options::options_type const & options::opts::name() \
+ { \
+ static options::options_type val(optstring, \
+ description, hasarg, \
+ &options::set_ ## name , \
+ &options::reset_opt_ ## name ); \
+ return val; \
+ } \
+ void options::reset_opt_ ## name () \
+ { \
+ name ## _given = false; \
+ reset_optset(&opts:: name); \
+ } \
+ void options::set_ ## name (std::string arg) \
+ { \
+ name ## _given = true; \
+ real_set_ ## name (arg); \
+ } \
void options::real_set_ ## name (std::string arg)
# define OPTSET_REL(parent, child)
@@ -185,10 +209,9 @@ options::options_type const & options::o
# undef OPTION
# undef OPTSET_REL
-
option::option_set
operator | (option::option_set const & opts,
- option::option_set const & (*fun)())
+ option::option_set const & (*fun)())
{
return opts | fun();
}
============================================================
--- mtn_cvs/options.hh c3d069fcf7845b6e8cf8a2819d73e98c69aaee8b
+++ mtn_cvs/options.hh 7bcd146217355875a516967d93b97f7f7a4db2a3
@@ -1,5 +1,11 @@
-// Copyright 2006 Timothy Brownawell
-// This is made available under the GNU GPL v2 or later.
+// Copyright (C) 2006 Timothy Brownawell
+//
+// This program is made available under the GNU GPL version 2.0 or
+// greater. See the accompanying file COPYING for details.
+//
+// This program is distributed WITHOUT ANY WARRANTY; without even the
+// implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+// PURPOSE.
#ifndef __OPTIONS_HH__
#define __OPTIONS_HH__
@@ -20,6 +26,7 @@ struct options
struct options
{
options();
+ const options & operator = (options const & other);
typedef boost::function reset_function;
typedef option::option option_type;
@@ -35,12 +42,12 @@ struct options
{
static options_type const & none ();
static options_type const & all_options ();
-# define OPTSET(name) \
+# define OPTSET(name) \
static options_type const & name ();
# define OPTVAR(optset, type, name, default_)
-#define OPTION(optset, name, hasarg, optstring, description) \
+#define OPTION(optset, name, hasarg, optstring, description) \
static options_type const & name ();
# define OPTSET_REL(parent, child)
@@ -53,21 +60,21 @@ struct options
# undef OPTSET_REL
};
-# define OPTSET(name) \
- private: \
+# define OPTSET(name) \
+ private: \
void reset_optset_ ## name ();
-# define OPTVAR(optset, type, name, default_) \
- public: \
- type name; \
+# define OPTVAR(optset, type, name, default_) \
+ public: \
+ type name; \
void reset_ ## name ();
-#define OPTION(optset, name, hasarg, optstring, description) \
- public: \
- bool name ## _given; \
-private: \
- void set_ ## name (std::string arg); \
- void real_set_ ## name (std::string arg); \
+#define OPTION(optset, name, hasarg, optstring, description) \
+ public: \
+ bool name ## _given; \
+private: \
+ void set_ ## name (std::string arg); \
+ void real_set_ ## name (std::string arg); \
void reset_opt_ ## name ();
# define OPTSET_REL(parent, child)
@@ -82,7 +89,7 @@ operator | (option::option_set
option::option_set
operator | (option::option_set const & opts,
- option::option_set const & (*fun)());
+ option::option_set const & (*fun)());
#endif
============================================================
--- mtn_cvs/options_list.hh a0c250180df7dd9509af7f0b036bad0e3eb93661
+++ mtn_cvs/options_list.hh b6d15c7c603036782d9a0eaa341c9cff02fdc5f3
@@ -21,35 +21,35 @@ OPTVAR(branch, branch_name, branchname,
#endif
OPTVAR(branch, branch_name, branchname, )
-OPTION(branch, branch, true, "branch,b", N_("select branch cert for operation"))
+OPTION(branch, branch, true, "branch,b", gettext_noop("select branch cert for operation"))
#ifdef option_bodies
{
branchname = branch_name(arg, origin::user);
}
#endif
-OPT(since, "since", std::string, , N_("set history start for CVS pull"))
+OPT(since, "since", std::string, , gettext_noop("set history start for CVS pull"))
#ifdef option_bodies
{
since = std::string(arg);
}
#endif
-OPT(full, "full", bool, false, N_("ignore already pulled CVS revisions"))
+OPT(full, "full", bool, false, gettext_noop("ignore already pulled CVS revisions"))
#ifdef option_bodies
{
full = true;
}
#endif
-OPT(no_time, "no-time", bool, false, N_("do not send Checkin-time command on push"))
+OPT(no_time, "no-time", bool, false, gettext_noop("do not send Checkin-time command on push"))
#ifdef option_bodies
{
no_time = true;
}
#endif
-OPT(first, "first", bool, false, N_("take first child if choice necessary"))
+OPT(first, "first", bool, false, gettext_noop("take first child if choice necessary"))
#ifdef option_bodies
{
first = true;
@@ -58,7 +58,7 @@ OPTION(revision, revision, true, "revisi
OPTVAR(revision, std::vector, revisions, )
OPTION(revision, revision, true, "revision,r",
- N_("select revision id(s) for operation"))
+ gettext_noop("select revision id(s) for operation"))
#ifdef option_bodies
{
revisions.push_back(revision_id(decode_hexenc(arg, origin::user),origin::user));
@@ -139,7 +139,7 @@ OPTVAR(globals, std::vector
#endif
OPTVAR(globals, std::vector, mtn_options, )
-OPTION(globals, mtn_option, true, "mtn-option", N_("pass option to monotone"))
+OPTION(globals, mtn_option, true, "mtn-option", gettext_noop("pass option to monotone"))
#ifdef option_bodies
{
mtn_options.push_back(std::string(arg));
@@ -174,14 +174,14 @@ OPTION(globals, dump, true, "dump",
#endif
// these options are passed transparently
-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"));
+TRANSOPT3(db, "db,d", gettext_noop("passed: set name of database"));
+TRANSOPT(rcfile, gettext_noop("passed: load extra rc file"));
+TRANSOPT_BOOL(nostd, gettext_noop("passed: do not load standard lua hooks"));
+TRANSOPT(keydir, gettext_noop("passed: set location of key store"));
+TRANSOPT3(key, "key,k", gettext_noop("passed: set key for signatures"));
+TRANSOPT_BOOL(norc, gettext_noop("passed: do not load ~/.monotone/monotonerc or _MTN/monotonerc lua files"));
+TRANSOPT(root, gettext_noop("passed: limit search for workspace to specified root"));
+TRANSOPT(confdir, gettext_noop("passed: set location of configuration directory"));
#undef TRANSOPT3
#undef TRANSOPT_BOOL