[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Monotone-debian] Bug#574562: monotone-viz incompatible with monotone ve
From: |
Francis Russell |
Subject: |
[Monotone-debian] Bug#574562: monotone-viz incompatible with monotone version in unstable |
Date: |
Mon, 22 Mar 2010 17:50:56 +0000 |
User-agent: |
Mozilla-Thunderbird 2.0.0.22 (X11/20090707) |
I've attached a patch I was sent from the author of the new stdio
changes for monotone-viz, Stéphane Gimenez against revision
142b487d0b2cc5e24e17998407f7921f2372ea3c in the
net.venge.monotone-viz.new-stdio branch that fixes a error with parsing
the monotone "format-version" line I encountered. I assume this patch
will make it into the new-stdio branch anyway but currently it isn't, so
I decided to forward it here.
Regards,
Francis
#
# old_revision [142b487d0b2cc5e24e17998407f7921f2372ea3c]
#
# patch "automate.ml"
# from [62bef3827396107a9fb8c65ac340cfda00abe7a0]
# to [81cd3139b4ac5a13091737bf47b0c2e1b62eea62]
#
============================================================
--- automate.ml 62bef3827396107a9fb8c65ac340cfda00abe7a0
+++ automate.ml 81cd3139b4ac5a13091737bf47b0c2e1b62eea62
@@ -407,20 +407,20 @@ let spawn mtn db =
chunks = [] ;
exit_cb = (fun _ -> assert false)
} in
- let head = String.create 4096 in
- while not (String.contains head '\n') do
- match Giochannel.read_chars p.p_out.out_w.w_chan head with
- | `NORMAL read -> ()
+ let rec check_version buf =
+ if String.contains buf '\n' then
+ String.length buf >= 18 && String.sub buf 0 18 = "format-version: 2\n"
+ else
+ match Giochannel.read_chars p.p_out.out_w.w_chan p.p_out.out_sb with
+ | `NORMAL read -> check_version (buf ^ String.sub p.p_out.out_sb 0 read)
| `EOF ->
Giochannel.shutdown p.p_out.out_w.w_chan false;
Giochannel.shutdown p.p_err.out_w.w_chan false;
failwith "mtn version 0.46 or above is required";
- | `AGAIN -> ()
- done;
- let accept =
- String.length head > 18 && String.sub head 0 18 = "format-version: 2\n"
+ | `AGAIN -> check_version buf
in
- if not accept then failwith "mtn stdio uses an unknown format-version";
+ if not (check_version "")
+ then failwith "mtn stdio uses an unknown format-version";
let pid = some child.Gspawn.pid in
ignore (Gspawn.add_child_watch ~prio:50 pid (reap_cb p pid)) ;
p.p_out.out_cb <- out_cb p ;