# # # add_file "legacy.cc" # # add_file "legacy.hh" # # patch "Makefile.am" # from [db13b3d43c984b2eddd2c4e48bc01f8925f9732d] # to [0d093162fd7f70ec376849b8c0179818e2b20c79] # # patch "legacy.cc" # from [] # to [7bc35fea7ce2533ea4aa4a2c71d79ded850be929] # # patch "legacy.hh" # from [] # to [5f191e1160c82979a87a0720b8fbc2d80a89ac0f] # # patch "revision.cc" # from [82e83d432d8f20206ca34205e92a236342bddb5d] # to [c9625b285471f59c9aca6b293d1a3dc139edfb9b] # ============================================================ --- Makefile.am db13b3d43c984b2eddd2c4e48bc01f8925f9732d +++ Makefile.am 0d093162fd7f70ec376849b8c0179818e2b20c79 @@ -47,6 +47,7 @@ paths.cc paths.hh \ roster_merge.cc roster_merge.hh \ merge.cc merge.hh \ + legacy.cc legacy.hh \ \ cleanup.hh unit_tests.hh interner.hh \ cycle_detector.hh randomfile.hh adler32.hh quick_alloc.hh \ ============================================================ --- legacy.cc +++ legacy.cc 7bc35fea7ce2533ea4aa4a2c71d79ded850be929 @@ -0,0 +1,37 @@ +// copyright (C) 2005 nathaniel smith +// all rights reserved. +// licensed to the public under the terms of the GNU GPL (>= 2) +// see the file COPYING for details + +#include "legacy.hh" +#include "basic_io.hh" + +namespace legacy +{ + void + read_dot_mt_attrs(data const & dat, dot_mt_attrs_map & attr) + { + basic_io::input_source src(dat(), ".mt-attrs"); + basic_io::tokenizer tok(src); + basic_io::parser parser(tok); + + std::string file, name, value; + + attr.clear(); + + while (parser.symp("file")) + { + parser.sym(); + parser.str(file); + file_path fp = file_path_internal(file); + + while (parser.symp() && + !parser.symp("file")) + { + parser.sym(name); + parser.str(value); + attr[fp][name] = value; + } + } + } +} ============================================================ --- legacy.hh +++ legacy.hh 5f191e1160c82979a87a0720b8fbc2d80a89ac0f @@ -0,0 +1,24 @@ +#ifndef __LEGACY_HH__ +#define __LEGACY_HH__ + +// copyright (C) 2005 nathaniel smith +// all rights reserved. +// licensed to the public under the terms of the GNU GPL (>= 2) +// see the file COPYING for details + +// old code needed for reading legacy data (so we can then convert it) + +#include +#include + +#include "paths.hh" + +namespace legacy +{ + typedef std::map > dot_mt_attrs_map; + + void + read_dot_mt_attrs(data const & dat, dot_mt_attrs_map & attr); +} + +#endif ============================================================ --- revision.cc 82e83d432d8f20206ca34205e92a236342bddb5d +++ revision.cc c9625b285471f59c9aca6b293d1a3dc139edfb9b @@ -36,6 +36,7 @@ #include "ui.hh" #include "vocab.hh" #include "safe_map.hh" +#include "legacy.hh" void revision_set::check_sane() const @@ -1208,8 +1209,8 @@ { file_data dat; app.db.get_file_version(i->second, dat); - oldstyle_attr_map attrs; - read_oldstyle_dot_mt_attrs(dat.inner(), attrs); + legacy::dot_mt_attrs_map attrs; + legacy::read_dot_mt_attrs(dat.inner(), attrs); for (oldstyle_attr_map::const_iterator j = attrs.begin(); j != attrs.end(); ++j) {