The unified diff between revisions [be157f28..] and [5c3ea9e5..] is displayed below. It can also be downloaded as a raw diff.

#
#
# patch "ChangeLog"
#  from [85c91026c2337bcd14c921adfe24326327ae6199]
#    to [c3089fbae7f78f8c0b6419f40270c96678d4cc0b]
#
# patch "netsync.cc"
#  from [248489d7ad1d4b104cd1e607ad1714205be6c5a2]
#    to [def56886b6d662112d0fe727c4ef833a04049f83]
#
# patch "vocab.cc"
#  from [81220896b3d16dfa324aae78d7e5bdae045c4d83]
#    to [41fd233b49106424431b40d9b021959b607590f2]
#
============================================================
--- ChangeLog	85c91026c2337bcd14c921adfe24326327ae6199
+++ ChangeLog	c3089fbae7f78f8c0b6419f40270c96678d4cc0b
@@ -162,6 +162,14 @@ 2005-09-27  Richard Levitte  <richard@le
 	(Branching and Merging) ended up as a a separate chapter of it's
 	own...

+2005-09-27  Matt Johnston  <matt@ucc.asn.au>
+
+	* netsync.cc (ancestry_fetcher): new approach to requesting file
+	and manifest deltas and full data. Tries to be more efficient
+	for the vcache of recontstructed data, and conceptually simpler
+
+	* tests/t_netsync_unrelated.at: passes, remove XFAIL
+
 2005-09-26  BenoƮt Dejean  <benoit@placenet.org>

 	* database.cc: Merged 3 strings.
@@ -338,14 +346,6 @@ 2005-09-16  Matt Johnston  <matt@ucc.asn
 	* botan/*: update to Botan 1.4.6
 	* Makefile.am: ditto

-2005-09-27  Matt Johnston  <matt@ucc.asn.au>
-
-	* netsync.cc (ancestry_fetcher): new approach to requesting file
-	and manifest deltas and full data. Tries to be more efficient
-	for the vcache of recontstructed data, and conceptually simpler
-
-	* tests/t_netsync_unrelated.at: passes, remove XFAIL
-
 2005-09-15  Timothy Brownawell  <tbrownaw@gmail.com>

 	* app_state.{cc,hh}: restrictions now understand --exclude
============================================================
--- netsync.cc	248489d7ad1d4b104cd1e607ad1714205be6c5a2
+++ netsync.cc	def56886b6d662112d0fe727c4ef833a04049f83
@@ -3628,7 +3628,7 @@ run_netsync_protocol(protocol_voice voic
 // a set of reverse file/manifest deltas (we stop when we hit an
 // already-seen or existing-in-db rev).
 //
-// at the same time, build up smaller set of forward deltas (files and
+// at the same time, build a (smaller) set of forward deltas (files and
 // manifests). these have a file/manifest in the new head as the
 // destination, and end up having an item already existing in the
 // database as the source (or null, in which case full data is
@@ -3686,8 +3686,8 @@ ancestry_fetcher::traverse_files(change_
     {
       file_id parent_file (delta_entry_src(d));
       file_id child_file (delta_entry_dst(d));
-      L(F("traverse_files parent %s child %s")
-        % parent_file % child_file);
+      MM(parent_file);
+      MM(child_file);

       I(!(parent_file == child_file));
       // when changeset format is altered to have [...]->[] deltas on deletion,
@@ -3697,14 +3697,12 @@ ancestry_fetcher::traverse_files(change_
       // request the reverse delta
       if (!null_id(parent_file))
         {
-          L(F("inserting file rev_deltas"));
           rev_file_deltas.insert(make_pair(child_file, parent_file));
         }

       // add any new forward deltas
       if (seen_files.find(child_file) == seen_files.end())
         {
-          L(F("inserting fwd_jump_deltas"));
           fwd_file_deltas.insert( make_pair( parent_file, child_file ) );
         }

@@ -3738,13 +3736,12 @@ ancestry_fetcher::traverse_manifest(mani
 ancestry_fetcher::traverse_manifest(manifest_id const & child_man,
                                     manifest_id const & parent_man)
 {
-  L(F("traverse_manifest parent %s child %s")
-    % parent_man % child_man);
+  MM(child_man);
+  MM(parent_man);
   I(!null_id(child_man));
   // add reverse deltas
   if (!null_id(parent_man))
     {
-      L(F("inserting manifest rev_deltas"));
       rev_manifest_deltas.insert(make_pair(child_man, parent_man));
     }

@@ -3781,7 +3778,7 @@ ancestry_fetcher::traverse_ancestry(set<
   for (set<revision_id>::const_iterator h = heads.begin();
        h != heads.end(); h++)
     {
-      L(F("inserting head %s") % *h);
+      L(F("traversing head %s") % *h);
       frontier.push_back(*h);
       seen_revs.insert(*h);
       manifest_id const & m = sess.ancestry[*h]->second.new_manifest;
@@ -3792,19 +3789,19 @@ ancestry_fetcher::traverse_ancestry(set<
   while (!frontier.empty())
     {
       revision_id const & rev = frontier.front();
+      MM(rev);

-      L(F("frontier %s") % rev);
       I(sess.ancestry.find(rev) != sess.ancestry.end());

       for (edge_map::const_iterator e = sess.ancestry[rev]->second.edges.begin();
            e != sess.ancestry[rev]->second.edges.end(); e++)
         {
           revision_id const & par = edge_old_revision(e);
+          MM(par);
           if (seen_revs.find(par) == seen_revs.end())
             {
               if (sess.ancestry.find(par) != sess.ancestry.end())
                 {
-                  L(F("push_back to frontier %s") % par);
                   frontier.push_back(par);
                 }
               seen_revs.insert(par);
@@ -3831,6 +3828,7 @@ ancestry_fetcher::request_rev_file_delta
   while (!frontier.empty())
     {
       file_id const child = frontier.top();
+      MM(child);
       I(!null_id(child));
       frontier.pop();

@@ -3840,24 +3838,18 @@ ancestry_fetcher::request_rev_file_delta
            d++)
         {
           file_id const & parent = d->second;
+          MM(parent);
           I(!null_id(parent));
           if (done_files.find(parent) == done_files.end())
             {
               done_files.insert(parent);
               if (!sess.app.db.file_version_exists(parent))
                 {
-                  L(F("requesting reverse file delta %s->%s")
-                    % child % parent);
                   sess.queue_send_delta_cmd(file_item,
                                             plain_id(child), plain_id(parent));
                   sess.reverse_delta_requests.insert(make_pair(plain_id(child),
                                                                plain_id(parent)));
                 }
-              else
-                {
-                  L(F("file %s exists, not requesting rev delta")
-                    % parent);
-                }
               frontier.push(parent);
             }
         }
@@ -3875,28 +3867,22 @@ ancestry_fetcher::request_files()
     {
       file_id const & anc = d->first;
       file_id const & child = d->second;
+      MM(anc);
+      MM(child);
       if (!sess.app.db.file_version_exists(child))
         {
           if (null_id(anc)
               || !sess.app.db.file_version_exists(anc))
             {
-              L(F("requesting full file %s") % child);
               sess.queue_send_data_cmd(file_item, plain_id(child));
             }
           else
             {
-              L(F("requesting forward delta %s->%s")
-                % anc % child);
               sess.queue_send_delta_cmd(file_item,
                                         plain_id(anc), plain_id(child));
               sess.note_item_full_delta(file_item, plain_id(child));
             }
         }
-      else
-        {
-          L(F("not requesting fwd delta %s->%s, already have dst")
-            % anc % child);
-        }

       // traverse up the reverse deltas
       request_rev_file_deltas(child, done_files);
@@ -3913,6 +3899,7 @@ ancestry_fetcher::request_rev_manifest_d
   while (!frontier.empty())
     {
       manifest_id const child = frontier.top();
+      MM(child);
       I(!null_id(child));
       frontier.pop();

@@ -3922,30 +3909,26 @@ ancestry_fetcher::request_rev_manifest_d
            d++)
         {
           manifest_id const & parent = d->second;
+          MM(parent);
           I(!null_id(parent));
           if (done_manifests.find(parent) == done_manifests.end())
             {
               done_manifests.insert(parent);
               if (!sess.app.db.manifest_version_exists(parent))
                 {
-                  L(F("requesting reverse manifest delta %s->%s")
-                    % child % parent);
                   sess.queue_send_delta_cmd(manifest_item,
                                             plain_id(child), plain_id(parent));
                   sess.reverse_delta_requests.insert(make_pair(plain_id(child),
                                                                plain_id(parent)));
                 }
-              else
-                {
-                  L(F("manifest %s exists, not requesting rev delta")
-                    % parent);
-                }
               frontier.push(parent);
             }
         }
     }
 }

+// could try and make this a template function, is the same as request_files(),
+// though it calls non-template functions
 void
 ancestry_fetcher::request_manifests()
 {
@@ -3957,28 +3940,22 @@ ancestry_fetcher::request_manifests()
     {
       manifest_id const & anc = d->first;
       manifest_id const & child = d->second;
+      MM(anc);
+      MM(child);
       if (!sess.app.db.manifest_version_exists(child))
         {
           if (null_id(anc)
               || !sess.app.db.manifest_version_exists(anc))
             {
-              L(F("requesting full manifest %s") % child);
               sess.queue_send_data_cmd(manifest_item, plain_id(child));
             }
           else
             {
-              L(F("requesting forward delta %s->%s")
-                % anc % child);
               sess.queue_send_delta_cmd(manifest_item,
                                         plain_id(anc), plain_id(child));
               sess.note_item_full_delta(manifest_item, plain_id(child));
             }
         }
-      else
-        {
-          L(F("not requesting fwd delta %s->%s, already have dst")
-            % anc % child);
-        }

       // traverse up the reverse deltas
       request_rev_manifest_deltas(child, done_manifests);
============================================================
--- vocab.cc	81220896b3d16dfa324aae78d7e5bdae045c4d83
+++ vocab.cc	41fd233b49106424431b40d9b021959b607590f2
@@ -231,6 +231,12 @@ void dump(revision_id const & r, std::st
 template
 void dump(revision_id const & r, std::string &);

+template
+void dump(manifest_id const & r, std::string &);
+
+template
+void dump(file_id const & r, std::string &);
+
 // the rest is unit tests

 #ifdef BUILD_UNIT_TESTS