# # # patch "ChangeLog" # from [623acaaec03c9ca4ceb82acef8f24eb68981fb6b] # to [4549cb0eaffc055eedb30df8ad460e4c2bf8d586] # # patch "database.cc" # from [276ab6fb1fb641b6103c8de2aafa0b1370e77dd2] # to [e57ba12849facff7c9f9475e839328223ff47162] # # patch "rev_height.cc" # from [ba9fccd90336ac0f483de87b801015a0df0c9ad8] # to [4aa9f2e8507ed8e151e14b7b54057066b33ffc2a] # # patch "rev_height.hh" # from [521990401ccc8a42b587ec18ef4c33e328a673e7] # to [9efa4efa7c64d3e8122bfdebdb056cbafd348d93] # ============================================================ --- ChangeLog 623acaaec03c9ca4ceb82acef8f24eb68981fb6b +++ ChangeLog 4549cb0eaffc055eedb30df8ad460e4c2bf8d586 @@ -1,3 +1,9 @@ +2006-11-11 Thomas Moschny + + * rev_height.hh, rev_height.cc: remove the dump method, add an + overload to the dump function to make heights work with MM(). + * database.cc (put_height_for_revision): Add some MM() calls. + 2006-10-31 Nathaniel Smith * work.cc (perform_rename): Tweak error message that just annoyed ============================================================ --- database.cc 276ab6fb1fb641b6103c8de2aafa0b1370e77dd2 +++ database.cc e57ba12849facff7c9f9475e839328223ff47162 @@ -1815,8 +1815,8 @@ database::put_height_for_revision(revisi { bool found(false); u32 childnr(0); - rev_height candidate; - rev_height parent; + rev_height candidate; MM(candidate); + rev_height parent; MM(parent); get_rev_height(edge_old_revision(e), parent); while(!found) ============================================================ --- rev_height.cc ba9fccd90336ac0f483de87b801015a0df0c9ad8 +++ rev_height.cc 4aa9f2e8507ed8e151e14b7b54057066b33ffc2a @@ -10,6 +10,7 @@ #include #include #include +#include #include "numeric_vocab.hh" #include "sanity.hh" @@ -17,6 +18,7 @@ using std::string; using std::ostream; using std::string; +using std::ostringstream; /* * Implementation note: hv, holding the raw revision height, is @@ -134,23 +136,23 @@ void rev_height::root_height(rev_height root.append(0); } -// for debugging purposes - -void rev_height::dump(ostream & os) const +ostream & operator <<(ostream & os, rev_height const & h) { bool first(true); - for (size_t i = 0; i < size(); ++i) + + for (size_t i = 0; i < h.size(); ++i) { if (!first) os << '.'; - os << read_at(i); + os << h.read_at(i); first = false; } + return os; } -ostream & operator <<(ostream & os, rev_height const & h) +void dump(rev_height const & h, string & out) { - h.dump(os); - return os; + ostringstream os; + os << h; + out = os.str(); } - ============================================================ --- rev_height.hh 521990401ccc8a42b587ec18ef4c33e328a673e7 +++ rev_height.hh 9efa4efa7c64d3e8122bfdebdb056cbafd348d93 @@ -34,7 +34,6 @@ public: string const & operator()() const; void child_height(rev_height & child, u32 nr) const; static void root_height(rev_height & root); - void dump(ostream & os) const; bool operator ==(rev_height const & other) const; bool operator < (rev_height const & other) const; @@ -55,8 +54,9 @@ public: { return !(*this < other); } + friend ostream & operator <<(ostream & os, rev_height const & h); }; -ostream & operator <<(ostream & os, rev_height const & h); +void dump(rev_height const & h, string & out); #endif // __REV_HEIGHT_HH_