# # # patch "main.cc" # from [9268c05179dea0356ec342c0b3458012ca1a7038] # to [837322b148744ad8c31e4251f3568eb84fa8f3b2] # # patch "misc.cc" # from [10644b4af7fe457dfbd3ab487743e90986d16411] # to [833a27abb5b91feaa4b59e5fec2875378c633c6d] # # patch "monotone.cc" # from [89803f1e9cd7fe3af6585aa7cafc8141d9a6d874] # to [19e35bb395d585e2ccd72c3fcf70cd9c8091f2b4] # ============================================================ --- main.cc 9268c05179dea0356ec342c0b3458012ca1a7038 +++ main.cc 837322b148744ad8c31e4251f3568eb84fa8f3b2 @@ -190,7 +190,10 @@ stuff.pack_end(rd); add(stuff); show_all_children(); - to_wc(); + // Initial WC scan. Call from a timeout, so we'll have our window up. + Glib::signal_timeout().connect( + sigc::bind_return(sigc::mem_fun(this, &mainwin::to_wc), + false), 0); } }; ============================================================ --- misc.cc 10644b4af7fe457dfbd3ab487743e90986d16411 +++ misc.cc 833a27abb5b91feaa4b59e5fec2875378c633c6d @@ -78,8 +78,8 @@ { while (mtn->is_busy()) { - for (int i = 0; i < 100 && mtn->is_busy() - && Gtk::Main::events_pending(); ++i) + for (int i = 0; i < 10 && mtn->is_busy() && + Gtk::Main::events_pending(); ++i) Gtk::Main::iteration(); string & str(mtn->output_err); if (str.size() == 0) @@ -101,11 +101,8 @@ void SyncDialog::callmtn() { - std::cerr<<"frob\n"; mtn->sync(); - std::cerr<<"friz\n"; do_wait(output); - std::cerr<<"franz\n"; } void UpdateDialog::callmtn() ============================================================ --- monotone.cc 89803f1e9cd7fe3af6585aa7cafc8141d9a6d874 +++ monotone.cc 19e35bb395d585e2ccd72c3fcf70cd9c8091f2b4 @@ -55,26 +55,34 @@ from = from.substr(size + c4 + 1); return done; } +bool process_packets(string & from, string & out) +{ + int s; + bool r; + do + { + s = from.size(); + r = process_packet(from, out); + } + while (!r && s != from.size()); + return r; } +} bool monotone::got_data(Glib::IOCondition c, Glib::RefPtr chan) { if (c == Glib::IO_HUP) { if (++done == 2) - (std::cerr<<"&"), child_exited(0, 0); - else - std::cerr<<"%"<read(data, 1040); -// gunichar data; -// chan->read(data); + chan->read(data, 1024); if (mode == STDIO) { tempstr += data; - bool last = process_packet(tempstr, output_std); + bool last = process_packets(tempstr, output_std); if (last) { child_exited(0, 0); @@ -92,17 +100,12 @@ { if (c == Glib::IO_HUP) { - std::cerr<read(data, 1040); -// gunichar data; -// chan->read(data); + chan->read(data, 1024); output_err += data; return true; } @@ -113,6 +116,8 @@ { Glib::RefPtr ioc = Glib::IOChannel::create_from_fd(from); ioc->set_flags(Glib::IO_FLAG_NONBLOCK); + ioc->set_encoding(""); + ioc->set_buffered(false); Glib::RefPtr ios = Glib::IOSource::create(ioc, Glib::IO_IN | Glib::IO_HUP); ios->connect(sigc::bind(sigc::mem_fun(*this, &monotone::got_data), ioc)); ios->attach(Glib::MainContext::get_default()); @@ -120,6 +125,8 @@ { Glib::RefPtr ioc = Glib::IOChannel::create_from_fd(errfrom); ioc->set_flags(Glib::IO_FLAG_NONBLOCK); + ioc->set_encoding(""); + ioc->set_buffered(false); Glib::RefPtr ios = Glib::IOSource::create(ioc, Glib::IO_IN | Glib::IO_HUP); ios->connect(sigc::bind(sigc::mem_fun(*this, &monotone::got_err), ioc)); ios->attach(Glib::MainContext::get_default()); @@ -147,6 +154,7 @@ } catch (Glib::SpawnError & e) { + std::cerr<<"Spawn error.\n"; return false; } setup_callbacks(); @@ -156,10 +164,9 @@ void monotone::child_exited(Glib::Pid p, int c) { - std::cerr<<"cleanup...\n"; stopped(); signal_done.emit(); - busy = false;std::cerr<<"no longer busy\n"; + busy = false; signal_done.clear(); output_std.clear(); output_err.clear(); @@ -228,13 +235,12 @@ void monotone::waitfor() { - while(busy && (Gtk::Main::events_pending() || !stopped())) + while(busy && (!stopped() || Gtk::Main::events_pending())) { Gtk::Main::iteration(); } if (busy) child_exited(0, 0); - std::cerr<<"Done waiting.\n"; } void @@ -274,21 +280,18 @@ { string & res(*resp); vector & out(*outp); - std::cerr<<"inventory... "; try { std::map renames; int begin = 0; int end = res.find_first_of("\r\n", begin); - std::cerr<<"(end = "<= 0) - {std::cerr<<"."; + { int sp1 = begin + 4; int sp2 = res.find(' ', sp1 + 1); int sp3 = res.find(' ', sp2 + 1); if (sp1 >= res.size() || sp2 == string::npos || sp3 == string::npos) { - std::cerr<<"!!!"; begin = -1; continue; } @@ -371,8 +374,9 @@ begin = -1; end = res.find_first_of("\r\n", begin); } - } catch (std::exception &) {std::cerr<<"Exception!\n"<