static void
calculate_base_revision(app_state & app, 
                        revision_id & rid,
                        revision_set & rev,
                        manifest_id & mid,
                        manifest_map & man)
{
  rev.edges.clear();
  man.clear();

  get_revision_id(rid);

  if (! rid.inner()().empty())
    {

      N(app.db.revision_exists(rid),
        F("base revision %s does not exist in database\n") % rid);
      
      app.db.get_revision_manifest(rid, mid);
      L(F("old manifest is %s\n") % mid);
      
      N(app.db.manifest_version_exists(mid),
        F("base manifest %s does not exist in database\n") % mid);
      
      app.db.get_manifest(mid, man);
    }

  L(F("old manifest has %d entries\n") % man.size());
}

static void
calculate_base_revision(app_state & app, 
                        revision_set & rev,
                        manifest_map & man)
{
  revision_id rid;
  manifest_id mid;
  calculate_base_revision(app, rid, rev, mid, man);
}

