# # patch "ChangeLog" # from [d495817d8d564432f79724cf232d8f42cfe9159e] # to [4c57466691fa535baf0f4f2ff36b08689758ceee] # # patch "change_set.cc" # from [140b7e4eaf348923275c40452cf25c0264966dfb] # to [38917404bd14c8ba874b57ac1069cb15332e1043] # # patch "change_set.hh" # from [de2ed49184b15ec2248ded7e9fd8b57949ecd522] # to [d530354cb57477ef5e3b9e961346861c61508cba] # # patch "manifest.cc" # from [d619536f6b940cc4ccd6def0a2e512b2eb1be910] # to [01be2c10947f302d4710f6c971632e471e95120f] # # patch "manifest.hh" # from [d86a3fe804cf18e9e31af16401dcda6391225288] # to [d9ac966b4214935008cbcd26f9099dc29c245810] # # patch "revision.cc" # from [f9c7fd64e999ea82f190e9f67fd27caabce6e5b4] # to [b365c3876cf86f508a78656fcf73acc1bf4411c1] # # patch "sanity.cc" # from [f8b6dbcdd2dd836d7a5bd26316c8da713e548bb2] # to [cd19ec78b13a57e665d99aa60a7b37bc892708c0] # # patch "sanity.hh" # from [842a7168fbbcd601cf425a76417d63871f85bebc] # to [2ad04caf94675dc7c13290e7e52551013b5136c7] # # patch "vocab.cc" # from [d76e379b5a6bc88ed11268a9a63cd4f4ecc798c0] # to [705631e329160226f4ef065c411ac42c22dd56c1] # # patch "vocab.hh" # from [d6352245e0e2260db3f53cd0f7731a7bc07fd225] # to [930a79d9ee7aba0064403ec0bf47b3c43036b3b9] # =============================================== --- ChangeLog d495817d8d564432f79724cf232d8f42cfe9159e +++ ChangeLog 4c57466691fa535baf0f4f2ff36b08689758ceee @@ -1,5 +1,14 @@ 2005-07-24 Nathaniel Smith + * sanity.{hh,cc} (dump): Remove templated version, add std::string + version. + * vocab.{hh,cc} (dump): Add ATOMIC/DECORATE/ENCODING dumpers. + * change_set.{hh,cc} (dump): Add change_set dumper. + * manifest.{hh,cc} (dump): Add manifest_map dumper. + * revision.cc (check_sane_history): Add some M()s. + +2005-07-24 Nathaniel Smith + * sanity.hh (class Musing, gasp, dump): Actually, take a std::string instead of a std::ostream; fits our idioms better. =============================================== --- change_set.cc 140b7e4eaf348923275c40452cf25c0264966dfb +++ change_set.cc 38917404bd14c8ba874b57ac1069cb15332e1043 @@ -2898,6 +2898,14 @@ dat = data(oss.str()); } +void +dump(change_set const & cs, std::string & out) +{ + data tmp; + write_change_set(cs, tmp); + out = tmp(); +} + #ifdef BUILD_UNIT_TESTS #include "unit_tests.hh" #include "sanity.hh" =============================================== --- change_set.hh de2ed49184b15ec2248ded7e9fd8b57949ecd522 +++ change_set.hh d530354cb57477ef5e3b9e961346861c61508cba @@ -223,4 +223,8 @@ parse_path_rearrangement(basic_io::parser & pa, change_set::path_rearrangement & pr); +// debugging + +void dump(change_set const & cs, std::string & out); + #endif // __CHANGE_SET_HH__ =============================================== --- manifest.cc d619536f6b940cc4ccd6def0a2e512b2eb1be910 +++ manifest.cc 01be2c10947f302d4710f6c971632e471e95120f @@ -271,4 +271,10 @@ dat = sstr.str(); } +void +dump(manifest_map const & man, std::string & out) +{ + data dat; + write_manifest_map(man, dat); + out = dat(); +} - =============================================== --- manifest.hh d86a3fe804cf18e9e31af16401dcda6391225288 +++ manifest.hh d9ac966b4214935008cbcd26f9099dc29c245810 @@ -99,4 +99,6 @@ void write_manifest_map(manifest_map const & man, data & dat); +void dump(manifest_map const & man, std::string & out); + #endif // __MANIFEST_HH__ =============================================== --- revision.cc f9c7fd64e999ea82f190e9f67fd27caabce6e5b4 +++ revision.cc b365c3876cf86f508a78656fcf73acc1bf4411c1 @@ -176,12 +176,14 @@ *current_to_child_changes_p, *old_to_child_changes_p); } + M(*old_to_child_changes_p); // we have the change_set; now, is it one we've seen before? if (changesets.find(old_id) != changesets.end()) { // If it is, then make sure the paths agree on the // changeset. + M(*changesets.find(old_id)->second); I(*changesets.find(old_id)->second == *old_to_child_changes_p); } else @@ -197,6 +199,8 @@ if (!null_id(old_id)) app.db.get_manifest(m_old_id, purported_m_child); apply_change_set(*old_to_child_changes_p, purported_m_child); + M(purported_m_child); + M(m_child); I(purported_m_child == m_child); } } =============================================== --- sanity.cc f8b6dbcdd2dd836d7a5bd26316c8da713e548bb2 +++ sanity.cc cd19ec78b13a57e665d99aa60a7b37bc892708c0 @@ -270,3 +270,10 @@ I(global_sanity.musings.back() == this); global_sanity.musings.pop_back(); } + +void +dump(std::string const & obj, std::string & out) +{ + out = obj; +} + =============================================== --- sanity.hh 842a7168fbbcd601cf425a76417d63871f85bebc +++ sanity.hh 2ad04caf94675dc7c13290e7e52551013b5136c7 @@ -9,7 +9,6 @@ #include #include #include -#include #include "boost/format.hpp" #include "boost/circular_buffer.hpp" @@ -246,12 +245,6 @@ #define fake_M(obj, line) real_M(obj, line) #define M(obj) fake_M(obj, __LINE__) -template void -dump(T const & obj, std::ostream & out) -{ - std::ostringstream out_s; - out_s << obj << "\n"; - out = out_s.str(); -} +void dump(std::string const & obj, std::string & out); #endif // __SANITY_HH__ =============================================== --- vocab.cc d76e379b5a6bc88ed11268a9a63cd4f4ecc798c0 +++ vocab.cc 705631e329160226f4ef065c411ac42c22dd56c1 @@ -269,7 +269,10 @@ \ ostream & operator<<(ostream & o, \ ty const & a) \ -{ return (o << a.s); } +{ return (o << a.s); } \ + \ +void dump(ty const & obj, std::string & out) \ +{ out = obj(); } #define ATOMIC_NOVERIFY(ty) ATOMIC(ty) @@ -298,7 +301,11 @@ \ template \ ostream & operator<<(ostream & o, enc const & e) \ -{ return (o << e.i); } +{ return (o << e.i); } \ + \ +template \ +void dump(enc const & obj, std::string & out) \ +{ out = obj(); } #define DECORATE(dec) \ @@ -320,9 +327,12 @@ \ template \ ostream & operator<<(ostream & o, dec const & d) \ -{ return (o << d.i); } +{ return (o << d.i); } \ + \ +template \ +void dump(dec const & obj, std::string & out) \ +{ dump(obj.inner(), out); } - #define EXTERN #include "vocab_terms.hh" =============================================== --- vocab.hh d6352245e0e2260db3f53cd0f7731a7bc07fd225 +++ vocab.hh 930a79d9ee7aba0064403ec0bf47b3c43036b3b9 @@ -24,6 +24,9 @@ std::ostream & operator<<(std::ostream &, \ enc const &); \ \ +template \ +void dump(enc const &, std::string &); \ + \ template \ class enc { \ INNER i; \ @@ -55,6 +58,9 @@ std::ostream & operator<<(std::ostream &, \ dec const &); \ \ +template \ +void dump(dec const &, std::string &); \ + \ template \ class dec { \ INNER i; \ @@ -95,7 +101,8 @@ friend std::ostream & operator<<(std::ostream &, \ ty const &); \ }; \ -std::ostream & operator<<(std::ostream &, ty const &); +std::ostream & operator<<(std::ostream &, ty const &); \ +void dump(ty const &, std::string &); #define ATOMIC_NOVERIFY(ty) \ ATOMIC(ty) \