# # patch "ChangeLog" # from [0ecbb568866836a4805b4d61134f72c2b14c064b] # to [b3e7d29d85bd050938da01d54c0d1a5139f9b317] # # patch "Makefile.am" # from [1f3cb32fc6408feb79cd788d61e6864e97815160] # to [f2f8f4a3b618f024155ee70722e07b2f13165418] # # patch "NEWS" # from [99678784bf033790e0cf616f35a4c016946b6f49] # to [4e6e48c7d84b9e778412486592d47032638dff3f] # # patch "change_set.cc" # from [0f26497e115e7818f164f2c3d9a469c6e784f742] # to [f45da9e6d6bc784324d6f606a12d21c34a6f306d] # # patch "constants.cc" # from [444b4e72f8a0f981f059357cf66a8b08c05ed734] # to [cc76e26e5126f2a43b1a91c0ce1213a77861d34c] # # patch "contrib/monotone.bash_completion" # from [f947568a0d2f341c8a95956f5f84ab250dff4a68] # to [796f8dc91d99045363cb95c381fe39f27bf27b5f] # # patch "contrib/monotone.el" # from [d73d2eedf89044fa347a8de9bdf2c9717d2cb151] # to [e40a9009178b2ca63eff28d78efe9722ce40f696] # # patch "database_check.cc" # from [20895ed494e278620fc03bb7f74655b331e25bef] # to [4cd1803a15f7248d15530e9a1b9f1440655341cf] # # patch "diff_patch.cc" # from [e798174667fdbb10359025f4b050b0b1c017705c] # to [c080a1bd6428d24243c0fc224414be6eb0fb7949] # # patch "monotone.texi" # from [13bed7469b4e155326caade82d7328129accdbec] # to [82e309cffe8832da1e871c00c9795af49531f1df] # # patch "netsync.cc" # from [8790de4edea2bc9f5cda7d35554b5cebc1de065d] # to [177a062ed520ffe6ba1b92a07fbc6f7d8bcb2c0f] # # patch "smap.hh" # from [bf2f49a88508bb21de8bc201c02e3050835a6d95] # to [d4acf13bff4208cfe2d87cb93fcb182a290d77f8] # # patch "std_hooks.lua" # from [cd6f8109837ec89d642901697933e23dd44faf1d] # to [a09034cf15e000407c7fdbea620de03f79f8a73e] # # patch "tests/t_database_check.at" # from [d348fd238d40a27205b242983edb1c13a017b82d] # to [a5bf8e5ed630bd268f71307fd95a23e7affbd5ff] # # patch "tests/t_vcheck.at" # from [247f296fb06b33fb2609231c983517384b50a437] # to [8656291fbb8e643e82f3bfb8ffa5616346388cb6] # # patch "ui.cc" # from [f0e2ff249a83fa8a210f961d773ca560bb281592] # to [bf5397526968d5189f12fef56ecd4990f622beef] # # patch "win32/process.cc" # from [080e7529f15e54f058f117b6c57d822257ebd48b] # to [f20f385828115ec65d4565e80d58822335c80bc2] # # patch "win32/terminal.cc" # from [956b84cf7bf5fb26788e77b380935d00291f060e] # to [f747b2f947980bbf6561cd97441709b82159cf29] # --- ChangeLog +++ ChangeLog @@ -1,3 +1,72 @@ +2005-04-15 Olivier Andrieu + + * diff_patch.cc(guess_binary): do not use '\x00' as first + character of a C string ... + +2005-04-15 Sebastian Spaeth + + * ui.cc: print byte progress to one decimal place + in k or M. + * netsync.cc: update dot ticker every 1024 bytes. + +2005-04-15 Matt Johnston + + * change_set.cc (confirm_proper_tree): use bitsets rather than maps + for tracking set membership. + * smap.hh: return reverse iterators properly, iterate over the vector + rather than self in ensure_sort() + +2005-04-14 Derek Scherger + + * database_check.cc (check_db): fail with N(...) when problems are + detected to exit with a non-zero status + +2005-04-14 Derek Scherger + + * monotone.texi (Informative): update description of 'diff' with + two revision arguments + +2005-04-14 Matthew Gregan + + * win32/process.cc: Fix build on MingW 3.2.0-rc[123] by adding + include. + +2005-04-14 Jon Bright + * win32/process.cc (process_spawn): Add some extra debug info + * std_hooks.lua (execute): If pid is -1, don't try and wait on + the process + +2005-04-14 Matt Johnston + + * change_set.cc (confirm_unique_entries_in_directories): use a + std::vector rather than std::map for better performance (only sort + once). + * smap.hh: an invariant + +2005-04-14 Nathaniel Smith + + * tests/t_vcheck.at: Update notes. + +2005-04-14 Jeremy Cowgar + + * monotone.texi (Making Changes): Fixed duplicate paragraph + * NEWS: Corrected spelling error in my name. + +2005-04-13 Nathaniel Smith + + * monotone.texi (Informative): 'diff' with two revision arguments + can now be filtered by file. + + * constants.cc (netcmd_payload_limit): Bump to 256 megs. + +2005-04-14 Olivier Andrieu + + * Makefile.am: silence cmp + +2005-04-14 Matthew Gregan + + * win32/terminal.cc (have_smart_terminal): Implement for Win32. + 2005-04-13 Matthew Gregan * tests/t_netsync_largish_file.at: Add test for netsyncing largish @@ -2727,7 +2796,7 @@ * AUTHORS: Mention Wojciech and Neil. * revision.cc (calculate_ancestors_from_graph): Make non-recursive. -2005-01-17 Wojciech Miłkowski +2005-01-17 Wojciech Miłkowski * std_hooks.lua: Teach about meld. --- Makefile.am +++ Makefile.am @@ -354,12 +354,12 @@ %.h: %.sql txt2c Makefile ./txt2c $< $(*F) >address@hidden - cmp address@hidden $@ || mv address@hidden $@ + cmp -s address@hidden $@ || mv address@hidden $@ rm -f address@hidden %.h: %.lua txt2c Makefile ./txt2c $< $(*F) >address@hidden - cmp address@hidden $@ || mv address@hidden $@ + cmp -s address@hidden $@ || mv address@hidden $@ rm -f address@hidden # A fake target so we can use MT/revision as a prerequisite, yet not @@ -371,7 +371,7 @@ if [ ! -f $@ ]; then echo "unknown" > $@; fi package_revision.c: package_revision.txt txt2c Makefile ./txt2c --strip-trailing --no-static $< package_revision >address@hidden - cmp address@hidden $@ || mv address@hidden $@ + cmp -s address@hidden $@ || mv address@hidden $@ rm -f address@hidden .PHONY: package_full_revision.txt apidocs @@ -388,7 +388,7 @@ echo ' further changes may have been made.') >> $@ package_full_revision.c: package_full_revision.txt txt2c Makefile ./txt2c --no-static $< package_full_revision >address@hidden - cmp address@hidden $@ || mv address@hidden $@ + cmp -s address@hidden $@ || mv address@hidden $@ rm -f address@hidden # automake doesn't build html docs --- NEWS +++ NEWS @@ -41,7 +41,7 @@ - New "--depth" argument to 'log'. Thanks to Richard Levitte . - 'db info' gives statistics on space usage. - - new command 'dropkey'. Thanks to Jeremey Cowgar + - new command 'dropkey'. Thanks to Jeremy Cowgar . - robustness improvement: if monotone crashes in a working directory and --dump and --debug were not specified, saves --- change_set.cc +++ change_set.cc @@ -18,6 +18,7 @@ #include #include #include +#include #include "basic_io.hh" #include "change_set.hh" @@ -513,19 +514,30 @@ static void confirm_proper_tree(path_state const & ps) { - std::map confirmed; - I(ps.find(root_tid) == ps.end()); + if (ps.empty()) + return; + + I(ps.find(root_tid) == ps.end()); // Note that this find() also ensures + // sortedness of ps. + + tid min_tid = ps.begin()->first; + tid max_tid = ps.rbegin()->first; + size_t tid_range = max_tid - min_tid + 1; + + boost::dynamic_bitset<> confirmed(tid_range); + boost::dynamic_bitset<> ancs(tid_range); + for (path_state::const_iterator i = ps.begin(); i != ps.end(); ++i) { tid curr = i->first; path_item item = i->second; - std::map ancs; + ancs.reset(); - while (confirmed.find(curr) == confirmed.end()) + while (confirmed.test(curr - min_tid) == false) { sanity_check_path_item(item); - I(ancs.find(curr) == ancs.end()); - ancs.insert(std::make_pair(curr,true)); + I(ancs.test(curr - min_tid) == false); + ancs.set(curr - min_tid); if (path_item_parent(item) == root_tid) break; else @@ -542,16 +554,14 @@ I(path_item_type(item) == ptype_directory); } } - std::copy(ancs.begin(), ancs.end(), - inserter(confirmed, confirmed.begin())); + confirmed |= ancs; } - I(confirmed.find(root_tid) == confirmed.end()); } static void confirm_unique_entries_in_directories(path_state const & ps) -{ - std::map, bool> entries; +{ + std::vector > entries; for (path_state::const_iterator i = ps.begin(); i != ps.end(); ++i) { if (null_name(path_item_name(i->second))) @@ -562,9 +572,27 @@ std::pair p = std::make_pair(path_item_parent(i->second), path_item_name(i->second)); - I(entries.find(p) == entries.end()); - entries.insert(std::make_pair(p,true)); + entries.push_back(p); } + + // Now we check that entries is unique + if (entries.empty()) + return; + + std::sort(entries.begin(), entries.end()); + + std::vector >::const_iterator leader, lagged; + leader = entries.begin(); + lagged = entries.begin(); + + I(leader != entries.end()); + ++leader; + while (leader != entries.end()) + { + I(*leader != *lagged); + ++leader; + ++lagged; + } } static void --- constants.cc +++ constants.cc @@ -148,7 +148,9 @@ + 1 // smallest uleb possible + 4); // adler32 - size_t const netcmd_payload_limit = 0xffffff; + // allow payloads up to 256 megs (this sets the in-practice maximum size of + // a compressed file/manifest). + size_t const netcmd_payload_limit = 2 << 27; size_t const netcmd_maxsz = netcmd_minsz + netcmd_payload_limit; size_t const netcmd_minimum_bytes_to_bother_with_gzip = 0xfff; --- contrib/monotone.bash_completion +++ contrib/monotone.bash_completion @@ -43,9 +43,7 @@ } _monotone() { - local cur=${COMP_WORDS[COMP_CWORD]} - local prev=${COMP_WORDS[COMP_CWORD-1]} - local mono_db + local cur prev mono_db for w in address@hidden ; do if [[ "$w" == --db=* ]] ; then @@ -55,12 +53,16 @@ if [ -z "$mono_db" ] ; then for i in address@hidden ; do [ $i -eq 0 ] && continue - if [ "${COMP_WORDS[$i-1]}" == --db ] ; then + prev="${COMP_WORDS[$i-1]}" + if [ $prev == --db -o $prev == -d ] ; then mono_db="--db=${COMP_WORDS[$i]}" ; break fi done fi + cur=${COMP_WORDS[COMP_CWORD]} + prev=${COMP_WORDS[COMP_CWORD-1]} + case $cur in --db=* | --rcfile=* | --dump=* ) cur="${cur#*=}" --- contrib/monotone.el +++ contrib/monotone.el @@ -1,13 +1,17 @@ ;;; monotone.el --- Run monotone from within Emacs. ;; Copyright 2005 by Olivier Andrieu +;; Version 0.2 2005-04-13 ;; This defines `monotone-diff', `monotone-status', `monotone-add', -;; `monotone-drop', `monotone-revert' and `monotone-commit'. They call -;; monotone on the current file. With a prefix argument (C-u) the -;; command is applied on the whole tree. +;; `monotone-drop', `monotone-revert' and `monotone-commit'. These +;; functions call the corresponding monotone command, restricted to +;; the current file. With a prefix argument (C-u) the command is +;; applied unrestricted (on the whole tree). As an exception, +;; `monotone-status' has the opposite behaviour: it is unrestricted by +;; default, restricted with a prefix argument. ;; /!\ beware of bugs: `monotone-commit' is more dangerous than the -;; other two as it modifies the database. +;; others since it writes to the database. (defvar monotone-program @@ -24,20 +28,21 @@ (append other-args (list arg)) other-args)) -(defun monotone-run (command &optional arg) - (unless buffer-file-name - (error "This buffer is not associated with a file")) - (let ((file - (if arg - nil - (file-name-nondirectory buffer-file-name))) - (dir (file-name-directory buffer-file-name))) +(defun monotone-run (command &optional global) + (let (monotone-arg + (dir default-directory)) + (unless global + (setq monotone-arg + (if buffer-file-name + (file-name-nondirectory buffer-file-name) + "."))) + (pop-to-buffer monotone-buffer) (setq buffer-read-only nil) (erase-buffer) (cd dir) (apply 'call-process monotone-program nil t nil - (may-append file command)) + (may-append monotone-arg command)) (goto-char (point-min)) (fundamental-mode) (setq buffer-read-only t) @@ -54,11 +59,11 @@ (diff-mode))) (defun monotone-status (arg) - "Run `monotone status' on the current buffer's file. When called with -a prefix argument, do it for the whole tree." + "Run `monotone status'. When called with a prefix argument, do it +for the current buffer's file only." (interactive "P") (save-selected-window - (monotone-run "status" arg))) + (monotone-run "status" (not arg)))) (defun monotone-add () "Run `monotone add' on the current buffer's file." @@ -75,12 +80,12 @@ (defun monotone-revert () "Run `monotone revert' on the current buffer's file." (interactive) - (if (and buffer-file-name - (yes-or-no-p - (format "Are you sure you want monotone to revert '%s' ? " buffer-file-name))) - (save-selected-window - (monotone-run "revert") - (revert-buffer t t)))) + (when (yes-or-no-p + (format "Are you sure you want monotone to revert '%s' ? " + (or buffer-file-name default-directory))) + (save-selected-window + (monotone-run "revert")) + (revert-buffer t t))) (defun monotone-install-keymap () (unless monotone-map @@ -122,36 +127,32 @@ "Run `monotone commit' on the current buffer's file. When called with a prefix argument, do it on the whole tree." (interactive "P") - (if (null buffer-file-name) - (error "This buffer is not associated with a file")) - (let ((file - (if arg - nil - (file-name-nondirectory buffer-file-name))) - (dir (file-name-directory buffer-file-name))) + (setq monotone-commit-arg + (cond (arg nil) + (buffer-file-name (file-name-nondirectory buffer-file-name)) + (t ".")) + monotone-commit-dir default-directory) + (pop-to-buffer "*monotone ChangeLog*") + (setq buffer-read-only nil) + (erase-buffer) + (cd monotone-commit-dir) + (apply 'call-process monotone-program nil t nil + (may-append monotone-commit-arg "status")) + (goto-char (point-min)) + (while (progn + (insert "MT: ") + (= 0 (forward-line 1)))) + (goto-char (point-min)) + (dolist + (l '("" + "MT: ----------------------------------------------------------------------" + "MT: Enter Log. Lines beginning with `MT:' are removed automatically." + "MT: Type C-c C-c to commit, kill the buffer to abort.")) + (insert l "\n")) + (goto-char (point-max)) + (insert "----------------------------------------------------------------------\n") + (text-mode) + (monotone-install-keymap) + (goto-char (point-min)) + (shrink-window-if-larger-than-buffer)) - (pop-to-buffer "*monotone ChangeLog*") - (setq monotone-commit-arg file - monotone-commit-dir dir) - (setq buffer-read-only nil) - (erase-buffer) - (cd dir) - (apply 'call-process monotone-program nil t nil - (may-append file "status")) - (goto-char (point-min)) - (while (progn - (insert "MT: ") - (= 0 (forward-line 1)))) - (goto-char (point-min)) - (dolist - (l '("" - "MT: ----------------------------------------------------------------------" - "MT: Enter Log. Lines beginning with `MT:' are removed automatically." - "MT: Type C-c C-c to commit, kill the buffer to abort.")) - (insert l "\n")) - (goto-char (point-max)) - (insert "----------------------------------------------------------------------\n") - (text-mode) - (monotone-install-keymap) - (goto-char (point-min)) - (shrink-window-if-larger-than-buffer))) --- database_check.cc +++ database_check.cc @@ -671,7 +671,8 @@ missing_keys; if (total > 0) - P(F("check complete: %d files; %d manifests; %d revisions; %d keys; %d certs; %d problems detected\n") + N(total == 0, + F("check complete: %d files; %d manifests; %d revisions; %d keys; %d certs; %d problems detected\n") % checked_files.size() % checked_manifests.size() % checked_revisions.size() --- diff_patch.cc +++ diff_patch.cc @@ -25,7 +25,8 @@ { // these do not occur in ASCII text files // FIXME: this heuristic is (a) crap and (b) hardcoded. fix both these. - if (s.find_first_of("\x00\x01\x02\x03\x04\x05\x06\x0e\x0f" + if (s.find_first_of('\x00') != string::npos || + s.find_first_of("\x01\x02\x03\x04\x05\x06\x0e\x0f" "\x10\x11\x12\x13\x14\x15\x16\x17\x18" "\x19\x1a\x1c\x1d\x1e\x1f") != string::npos) return true; --- monotone.texi +++ monotone.texi @@ -1886,16 +1886,6 @@ @end group @end smallexample -and logs her changes in @file{MT/log} right away so she does not -forget what she has done: - address@hidden address@hidden -$ vi MT/log -* src/banana.c: Added polling implementation address@hidden group address@hidden smallexample - Later, she commits her work. Monotone again invokes an external editor for her to edit her log message, but this time it fills in the messages she's written so far, and she simply checks them over one last time @@ -3525,6 +3515,7 @@ @itemx monotone diff address@hidden @itemx monotone diff address@hidden @var{pathname...} @itemx monotone diff address@hidden address@hidden address@hidden monotone diff address@hidden address@hidden @var{pathname...} These commands print out GNU ``unified diff format'' textual difference listings between various manifest versions. With no @option{--revision} @@ -3535,9 +3526,7 @@ differences between the revision @var{id} and the current revision in the working copy. With two @option{--revision} options @command{diff} will print the differences between revisions @var{id1} and @var{id2}, -ignoring any working copy. Note that no @var{pathname...} arguments may -be specified to restrict the diff output in this case. Restrictions may -only be applied to the current, in-progress, working copy revision. +ignoring any working copy. In all cases, monotone will print a textual summary -- identical to the summary presented by @command{monotone status} -- of the logical @@ -3546,8 +3535,8 @@ a program processing the diff, such as @command{patch}. Specifying pathnames to the @command{diff} command restricts the set of -changes that are visible and results in only a partial diff of the -working copy. Changes to files not included in the specified set of +changes that are visible and results in only a partial diff between +two revisions. Changes to files not included in the specified set of pathnames will be ignored. From within a subdirectory of the working copy the @command{diff} --- netsync.cc +++ netsync.cc @@ -2884,8 +2884,8 @@ session sess(role, client_voice, collections, all_collections, app, address(), server.get_socketfd(), timeout); - sess.byte_in_ticker.reset(new ticker("bytes in", ">", 256, true)); - sess.byte_out_ticker.reset(new ticker("bytes out", "<", 256, true)); + sess.byte_in_ticker.reset(new ticker("bytes in", ">", 1024, true)); + sess.byte_out_ticker.reset(new ticker("bytes out", "<", 1024, true)); if (role == sink_role) { sess.cert_in_ticker.reset(new ticker("certs in", "c", 3)); --- smap.hh +++ smap.hh @@ -86,10 +86,11 @@ std::sort(vec.begin(), vec.end(), val_cmp); // make sure we don't have any duplicate entries const_iterator leader, lagged; - lagged = begin(); - leader = begin(); + lagged = vec.begin(); + leader = vec.begin(); + I(leader != vec.end()); ++leader; - for (; leader != end(); ++lagged, ++leader) + for (; leader != vec.end(); ++lagged, ++leader) I(lagged->first != leader->first); damaged = false; } @@ -164,13 +165,13 @@ iterator begin() { return vec.begin(); } iterator end() { return vec.end(); } - iterator rbegin() { return vec.rbegin(); } - iterator rend() { return vec.rend(); } + reverse_iterator rbegin() { return vec.rbegin(); } + reverse_iterator rend() { return vec.rend(); } const_iterator begin() const { return vec.begin(); } const_iterator end() const { return vec.end(); } - const_iterator rbegin() const { return vec.rbegin(); } - const_iterator rend() const { return vec.rend(); } + const_reverse_iterator rbegin() const { return vec.rbegin(); } + const_reverse_iterator rend() const { return vec.rend(); } bool empty() const { return vec.empty(); } size_type size() const { return vec.size(); } --- std_hooks.lua +++ std_hooks.lua @@ -15,7 +15,7 @@ local pid local ret = -1 pid = spawn(path, unpack(arg)) - ret, pid = wait(pid) + if (pid ~= -1) then ret, pid = wait(pid) end return ret end --- tests/t_database_check.at +++ tests/t_database_check.at @@ -60,7 +60,7 @@ AT_CHECK(MONOTONE db execute "delete from files where id='$FILE2'", [], [ignore], [ignore]) -AT_CHECK(MONOTONE db check --ticker=dot, [], [ignore], [stderr]) +AT_CHECK(MONOTONE db check --ticker=dot, [1], [ignore], [stderr]) AT_CHECK(grep 'database is good' stderr, [1], [ignore], [ignore]) AT_CHECK(grep 'problems detected' stderr, [0], [ignore], [ignore]) AT_CHECK(grep '1 missing file' stderr, [0], [ignore], [ignore]) @@ -74,13 +74,13 @@ AT_CHECK(MONOTONE read < fileX, [], [ignore], [ignore]) AT_CHECK(MONOTONE read < manifestX, [], [ignore], [ignore]) -AT_CHECK(MONOTONE db check --ticker=dot, [], [ignore], [stderr]) +AT_CHECK(MONOTONE db check --ticker=dot, [1], [ignore], [stderr]) AT_CHECK(grep '1 unreferenced file' stderr, [0], [ignore], [ignore]) AT_CHECK(grep '1 unreferenced manifest' stderr, [0], [ignore], [ignore]) AT_CHECK(grep '7 missing files' stderr, [0], [ignore], [ignore]) AT_CHECK(MONOTONE db execute "delete from revision_ancestry", [], [ignore], [ignore]) -AT_CHECK(MONOTONE db check --ticker=dot, [], [ignore], [stderr]) +AT_CHECK(MONOTONE db check --ticker=dot, [1], [ignore], [stderr]) AT_CHECK(grep '2 mismatched parent' stderr, [0], [ignore], [ignore]) AT_CHECK(grep '2 mismatched child' stderr, [0], [ignore], [ignore]) @@ -90,34 +90,34 @@ XDELTA_HH="68d15dc01398c7bb375b1a90fbb420bebef1bac7" AT_CHECK(MONOTONE db execute "insert into revision_ancestry values('$XDELTA_CC', '$XDELTA_HH')", [], [ignore], [ignore]) -AT_CHECK(MONOTONE db check --ticker=dot, [], [ignore], [stderr]) +AT_CHECK(MONOTONE db check --ticker=dot, [1], [ignore], [stderr]) AT_CHECK(grep '3 mismatched parent' stderr, [0], [ignore], [ignore]) AT_CHECK(grep '3 mismatched child' stderr, [0], [ignore], [ignore]) AT_CHECK(grep '2 missing revision' stderr, [0], [ignore], [ignore]) AT_CHECK(MONOTONE db execute "delete from manifest_deltas where id='$MAN1'", [], [ignore], [ignore]) -AT_CHECK(MONOTONE db check --ticker=dot, [], [ignore], [stderr]) +AT_CHECK(MONOTONE db check --ticker=dot, [1], [ignore], [stderr]) AT_CHECK(grep '1 missing manifest' stderr, [0], [ignore], [ignore]) AT_CHECK(grep '3 revisions with bad history' stderr, [0], [ignore], [ignore]) AT_CHECK(MONOTONE db execute "delete from revisions where id='$REV1'", [], [ignore], [ignore]) -AT_CHECK(MONOTONE db check --ticker=dot, [], [ignore], [stderr]) +AT_CHECK(MONOTONE db check --ticker=dot, [1], [ignore], [stderr]) AT_CHECK(grep '3 missing revision' stderr, [0], [ignore], [ignore]) AT_CHECK(grep '2 revisions with bad history' stderr, [0], [ignore], [ignore]) echo "$REV2:comment:this is a test:address@hidden:bogus sig" | sha1sum | read HASH AT_CHECK(MONOTONE db execute "insert into revision_certs values ('$HASH', '$REV2', 'comment', 'this is a test', 'address@hidden', 'bogus sig')", [], [ignore], [ignore]) -AT_CHECK(MONOTONE db check --ticker=dot, [], [ignore], [stderr]) +AT_CHECK(MONOTONE db check --ticker=dot, [1], [ignore], [stderr]) AT_CHECK(grep '1 bad sig' stderr, [0], [ignore], [ignore]) AT_CHECK(MONOTONE db execute "delete from revision_certs where name = 'date'", [], [ignore], [stderr]) -AT_CHECK(MONOTONE db check --ticker=dot, [], [ignore], [stderr]) +AT_CHECK(MONOTONE db check --ticker=dot, [1], [ignore], [stderr]) AT_CHECK(grep '2 missing certs' stderr, [0], [ignore], [ignore]) AT_CHECK(grep '2 mismatched certs' stderr, [0], [ignore], [ignore]) AT_CHECK(MONOTONE db execute "delete from public_keys", [], [ignore], [stderr]) -AT_CHECK(MONOTONE db check --ticker=dot, [], [ignore], [stderr]) +AT_CHECK(MONOTONE db check --ticker=dot, [1], [ignore], [stderr]) AT_CHECK(grep '1 missing key' stderr, [0], [ignore], [ignore]) AT_CHECK(grep '10 unchecked signatures' stderr, [0], [ignore], [ignore]) --- tests/t_vcheck.at +++ tests/t_vcheck.at @@ -19,10 +19,9 @@ # The original 'vcheck' was ripped out when manifest and file certs # were removed, and never quite did the right thing anyway. (It only # applied to manifests, in particular.) It may be useful to reference -# the code, though: see, say, -# 727d28b35f1fcbc91c0183fca2a6cabbe7cf21d7, or t:monotone-0.16. In -# particular, mac.hh should be useful. Note also the section -# "Accidental collision" in monotone.texi. +# the code, though: see t:monotone-0.16. In particular, mac.hh should +# be useful. Note also the section "Accidental collision" in +# monotone.texi. # There are a few ways to re-add this. The simplest is probably to # have a cert on revisions that contains @@ -36,6 +35,18 @@ # This reduces space overhead, too, since certs's space usage adds up, # and does so for project members who aren't worried about SHA1 # collisions too... +# +# an alternative approach would be to contain: +# - a salt/nonce +# - a MAC of (length-prefixed revision) + (length prefixed manifest) +# + (length prefixed versions of each file in the manifest, in manifest order) +# this is small, and just as safe. it is rather expensive to create +# or check, though, since you have to load all that data, so maybe the +# optimization above where you only hash mentioned files would be +# good. OTOH, if you hash everything, then you can use them +# sparingly, and be sure that the versions so certed really are safe; +# if you only hash some pieces, you have to cert your entire history +# in order to "trust" any one snapshot at all. AT_CHECK(false) --- ui.cc +++ ui.cc @@ -5,6 +5,7 @@ #include "transforms.hh" #include +#include #include // copyright (C) 2002, 2003 graydon hoare @@ -84,15 +85,28 @@ i != ui.tickers.end(); ++i) { string suffix; - int div = 1; + ostringstream disptick; if (i->second->kilocount && i->second->ticks >= 10000) - { - div = 1024; - suffix = "k"; + { // automatic unit conversion is enabled + float div; + if (i->second->ticks >= 1048576) { + // ticks >=1MB, use Mb + div = 1048576; + suffix = "M"; + } else { + // ticks <1MB, use kb + div = 1024; + suffix = "k"; + } + disptick << std::fixed << std::setprecision(1) << + (i->second->ticks / div); + } else { + // no automatic unit conversion. + disptick << i->second->ticks; } tickline += string(" [") - + i->first + ": " + lexical_cast(i->second->ticks / div) + + i->first + ": " + disptick.str() + suffix + "]"; } --- win32/process.cc +++ win32/process.cc @@ -1,9 +1,10 @@ // copyright (C) 2005 Jon Bright // all rights reserved. // licensed to the public under the terms of the GNU GPL (>= 2) // see the file COPYING for details #include +#include #include #include "sanity.hh" @@ -34,13 +35,16 @@ realexelen = strlen(argv[0])+1+MAX_PATH; realexe = (char*)malloc(realexelen); if (realexe==NULL) return 0; + L(F("searching for exe: %s\n") % argv[0]); if (SearchPath(NULL, argv[0], ".exe", realexelen, realexe, &filepart)==0) { + L(F("SearchPath failed, err=%d\n") % GetLastError()); free(realexe); return -1; } std::ostringstream cmdline_ss; + L(F("building command line\n")); cmdline_ss << realexe; for (const char *const *i = argv+1; *i; ++i) { @@ -73,6 +77,7 @@ /* We don't need to set any of the STARTUPINFO members */ if (CreateProcess(realexe, (char*)cmd.c_str(), NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi)==0) { + L(F("CreateProcess failed, err=%d\n") % GetLastError()); free(realexe); return -1; } --- win32/terminal.cc +++ win32/terminal.cc @@ -5,12 +5,25 @@ // see the file COPYING for details #include +#include +#include + #include "platform.hh" bool have_smart_terminal() { - return true; + std::string term; + if (const char* term_cstr = getenv("TERM")) + term = term_cstr; + else + term = ""; + + if (term == "" || term == "emacs" || term == "dumb" + || !_isatty(_fileno(stdout))) + return false; + else + return true; } unsigned int terminal_width()