#
# patch "ChangeLog"
# from [a1d75a1938a57a50148a7f00317136989de76705]
# to [cc172b1034bf45c6a5a48cf35d12ba257e3bd457]
#
# patch "change_set.cc"
# from [c9554a69662fecf70ead4b8fec54eab5c355118a]
# to [f45da9e6d6bc784324d6f606a12d21c34a6f306d]
#
# patch "database_check.cc"
# from [1098ea2b6e2a53449fd89dd6ae815f42d4206cd4]
# to [924b949941d72064a292451e72c28bfb2e80755c]
#
# patch "monotone.texi"
# from [182448f115ae70d11d3e594e4c88aae731577213]
# to [82e309cffe8832da1e871c00c9795af49531f1df]
#
# patch "smap.hh"
# from [8fb308c5059d3d572a078c96a6937ed989b425ec]
# to [d4acf13bff4208cfe2d87cb93fcb182a290d77f8]
#
# patch "tests/t_database_check.at"
# from [11b64267ef57980019f461ea1acca582d2cb989e]
# to [3ea731d55685488c6dadb5580b4cd04dc130e855]
#
--- ChangeLog
+++ ChangeLog
@@ -1,8 +1,25 @@
2005-04-15 Olivier Andrieu
* diff_patch.cc(guess_binary): do not use '\x00' as first
character of a C string ...
+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
--- 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,10 +554,8 @@
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
--- 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()
--- monotone.texi
+++ monotone.texi
@@ -3526,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
@@ -3537,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}
--- smap.hh
+++ smap.hh
@@ -86,11 +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();
- I(leader != end());
+ 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;
}
@@ -165,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(); }
--- 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])