# # # patch "policies/base_policy.cc" # from [121eef2b7addf65e07a3a9989c7195c07c9cf189] # to [bd4d5d8b816f72573927c8b3181fcb318cb7cd1f] # # patch "policies/policy.cc" # from [7551a8648e7c09d1434d5c0730a4061b6fd92955] # to [0e66bf7e1fcf734fdb534a15c1de094d2a463b93] # ============================================================ --- policies/base_policy.cc 121eef2b7addf65e07a3a9989c7195c07c9cf189 +++ policies/base_policy.cc bd4d5d8b816f72573927c8b3181fcb318cb7cd1f @@ -11,16 +11,19 @@ #include "base.hh" #include "policies/base_policy.hh" +#include "branch_name.hh" +#include "lua_hooks.hh" +#include "options.hh" #include "transforms.hh" #include using std::make_pair; using std::map; +using std::pair; +using std::string; class database; -class lua_hooks; -class options; namespace policies { base_policy::base_policy(database & db, options const & opts, lua_hooks & lua): @@ -38,7 +41,8 @@ namespace policies { for (override_map::const_iterator i = opts.policy_revisions.begin(); i != opts.policy_revisions.end(); ++i) { - id r = decode_hexenc(i->second); + id r; + decode_hexenc(i->second, r); delegations.insert(make_pair(i->first(), delegation(revision_id(r)))); _empty = false; } @@ -46,19 +50,19 @@ namespace policies { typedef map hook_map; hook_map hm; lua.hook_get_projects(hm); - for (hm::const_iterator i = hm.begin(); i != hm.end(); ++i) + for (hook_map::const_iterator i = hm.begin(); i != hm.end(); ++i) { if (delegations.find(i->first) == delegations.end()) { - del_map::iterator d = delegations.insert(make_pair(i->first, delegation())); - d->second.deserialize(i->second()); + pair r; + r = delegations.insert(make_pair(i->first, delegation())); + r.first->second.deserialize(i->second()); _empty = false; } } } } -#endif // Local Variables: // mode: C++ // fill-column: 76 ============================================================ --- policies/policy.cc 7551a8648e7c09d1434d5c0730a4061b6fd92955 +++ policies/policy.cc 0e66bf7e1fcf734fdb534a15c1de094d2a463b93 @@ -13,6 +13,11 @@ #include "keys.hh" +using boost::shared_ptr; + +using std::map; +using std::string; + namespace policies { policy::policy() { @@ -23,6 +28,19 @@ namespace policies { key_name policy::get_key_name(key_id const & ident) const { + for (key_map::const_iterator k = keys.begin(); + k != keys.end(); ++k) + { + key_id test; + key_hash_code(k->second.first, k->second.second, test); + if (ident == test) + return key_name(k->first, origin::internal); + } + shared_ptr p = parent.lock(); + if (p) + return p->get_key_name(ident); + else + return key_name(); } key_id policy::get_key_id(key_name const & ident) const @@ -34,7 +52,7 @@ namespace policies { key_hash_code(k->second.first, k->second.second, out); return out; } - boost::shared_ptr p = parent.lock(); + shared_ptr p = parent.lock(); if (p) return p->get_key_id(ident); else