# # # patch "automate.cc" # from [3107ad5560ae95219add8b20a390c3d86657886f] # to [74da2033df4c79e12405c1606d64d451b009090b] # # patch "vocab.cc" # from [3e3e800eaaff70e998b5ee77e9298ea30378fb16] # to [deef30de4cfcde66bf6638aaf650c58d93748302] # # patch "vocab_macros.hh" # from [771e268dcb47fc02cb0f216ee4bacbf20785dfa1] # to [6fe5da4585e77ac009b38e567aec9a362194cc88] # ============================================================ --- automate.cc 3107ad5560ae95219add8b20a390c3d86657886f +++ automate.cc 74da2033df4c79e12405c1606d64d451b009090b @@ -1207,13 +1207,12 @@ CMD_AUTOMATE(get_revision, N_("REVID"), database db(app); revision_data dat; - hexenc hrid(idx(args, 0)()); - revision_id rid(decode_hexenc(hrid())); + revision_id rid(decode_hexenc(idx(args, 0)())); N(db.revision_exists(rid), - F("no revision %s found in database") % hrid); + F("no revision %s found in database") % rid); db.get_revision(rid, dat); - L(FL("dumping revision %s") % hrid); + L(FL("dumping revision %s") % rid); output.write(dat.inner()().data(), dat.inner()().size()); } @@ -1398,8 +1397,7 @@ CMD_AUTOMATE(get_manifest_of, N_("[REVID { revision_id rid = revision_id(decode_hexenc(idx(args, 0)())); N(db.revision_exists(rid), - F("no revision %s found in database") - % encode_hexenc(rid.inner()())); + F("no revision %s found in database") % rid); db.get_roster(rid, new_roster); } @@ -1881,15 +1879,13 @@ CMD_AUTOMATE(get_content_changed, N_("RE ident = revision_id(decode_hexenc(idx(args, 0)())); N(db.revision_exists(ident), - F("no revision %s found in database") - % encode_hexenc(ident.inner()())); + F("no revision %s found in database") % ident); db.get_roster(ident, new_roster, mm); file_path path = file_path_external(idx(args,1)); N(new_roster.has_node(path), F("file %s is unknown for revision %s") - % path - % encode_hexenc(ident.inner()())); + % path % ident); node_t node = new_roster.get_node(path); marking_map::const_iterator m = mm.find(node->self); @@ -1947,14 +1943,12 @@ CMD_AUTOMATE(get_corresponding_path, N_( ident = revision_id(decode_hexenc(idx(args, 0)())); N(db.revision_exists(ident), - F("no revision %s found in database") - % encode_hexenc(ident.inner()())); + F("no revision %s found in database") % ident); db.get_roster(ident, new_roster); old_ident = revision_id(decode_hexenc(idx(args, 2)())); N(db.revision_exists(old_ident), - F("no revision %s found in database") - % encode_hexenc(old_ident.inner()())); + F("no revision %s found in database") % old_ident); db.get_roster(old_ident, old_roster); file_path path = file_path_external(idx(args,1)); ============================================================ --- vocab.cc 3e3e800eaaff70e998b5ee77e9298ea30378fb16 +++ vocab.cc deef30de4cfcde66bf6638aaf650c58d93748302 @@ -32,7 +32,7 @@ verify(hexenc const & val) for (string::const_iterator i = val().begin(); i != val().end(); ++i) { N(is_xdigit(*i), - F("bad character '%c' in id name '%s'") % *i % val); + F("bad character '%c' in '%s'") % *i % val); } } @@ -50,25 +50,19 @@ verify(hexenc const & val) N(is_xdigit(*i), F("bad character '%c' in id name '%s'") % *i % val); } - val.ok = true; } +// ATOMIC types ... inline void verify(id & val) { - if (val.ok) - return; - if (val().empty()) return; - N((val().size() == constants::sha1_digest_length) || - (val().size() == constants::idlen), - F("invalid ID '%s'") - % encode_hexenc(val())); + N(val().size() == constants::idlen_bytes, + F("invalid ID '%s'") % val); } -// ATOMIC types ... inline void verify(symbol const & val) { ============================================================ --- vocab_macros.hh 771e268dcb47fc02cb0f216ee4bacbf20785dfa1 +++ vocab_macros.hh 6fe5da4585e77ac009b38e567aec9a362194cc88 @@ -107,41 +107,8 @@ public: #define hh_ATOMIC(ty) hh_ATOMIC_HOOKED(ty,) #define hh_ATOMIC_NOVERIFY(ty) hh_ATOMIC(ty) +#define hh_ATOMIC_BINARY(ty) hh_ATOMIC(ty) - -#define hh_ATOMIC_BINARY(ty) \ -class ty { \ - immutable_string s; \ -public: \ - bool ok; \ - ty() : ok(false) {} \ - explicit ty(std::string const & str); \ - ty(ty const & other); \ - std::string const & operator()() const \ - { return s.get(); } \ - bool operator<(ty const & other) const \ - { return s.get() < other(); } \ - ty const & operator=(ty const & other); \ - bool operator==(ty const & other) const \ - { return s.get() == other(); } \ - bool operator!=(ty const & other) const \ - { return s.get() != other(); } \ - friend void verify(ty &); \ - friend void verify_full(ty &); \ - friend std::ostream & operator<<(std::ostream &, \ - ty const &); \ - struct symtab \ - { \ - symtab(); \ - ~symtab(); \ - }; \ -}; \ -std::ostream & operator<<(std::ostream &, ty const &); \ -template <> \ -void dump(ty const &, std::string &); \ -inline void verify_full(ty &) {} - - //CC @@ -197,17 +164,14 @@ ty::ty(string const & str) : : str) \ { verify(*this); } \ \ -ty::ty(ty const & other) : \ - s(other.s) \ -{ verify(*this); } \ +ty::ty(ty const & other) : s(other.s) {} \ \ ty const & ty::operator=(ty const & other) \ -{ s = other.s; ok = other.ok; \ - verify(*this); return *this; } \ +{ s = other.s; return *this; } \ \ - std::ostream & operator<<(std::ostream & o,\ - ty const & a) \ - { return (o << encode_hexenc(a.s.get())); }\ +std::ostream & operator<<(std::ostream & o, \ + ty const & a) \ +{ return (o << encode_hexenc(a.s.get())); } \ \ ty::symtab::symtab() \ { ty ## _tab_active++; } \