* its late - put_public_key of course needs a specific database

* do not throw around exceptions if a key which should be removed is not found in the database
This commit is contained in:
Thomas Keller 2010-09-13 01:13:49 +00:00
parent 0f9f337e66
commit a32d6d8265

View File

@ -163,7 +163,6 @@ class IDF_Plugin_SyncMonotone
$parsed_keyinfo = IDF_Scm_Monotone_BasicIO::parse($keyinfo); $parsed_keyinfo = IDF_Scm_Monotone_BasicIO::parse($keyinfo);
} }
catch (Exception $e) { catch (Exception $e) {
echo $e->getTraceAsString(); exit;
throw new IDF_Scm_Exception(sprintf( throw new IDF_Scm_Exception(sprintf(
__('Could not parse key information: %s'), $e->getMessage() __('Could not parse key information: %s'), $e->getMessage()
)); ));
@ -184,11 +183,11 @@ class IDF_Plugin_SyncMonotone
); );
$clientkey_pubdata = self::_mtn_exec($cmd); $clientkey_pubdata = self::_mtn_exec($cmd);
$cmd = sprintf('au put_public_key --confdir=%s %s', $cmd = sprintf('au put_public_key --db=%s %s',
escapeshellarg($projectpath), escapeshellarg($dbfile),
escapeshellarg($clientkey_pubdata) escapeshellarg($clientkey_pubdata)
); );
$keyinfo = self::_mtn_exec($cmd); self::_mtn_exec($cmd);
} }
// //
@ -631,9 +630,14 @@ class IDF_Plugin_SyncMonotone
$stdio = $mtn->getStdio(); $stdio = $mtn->getStdio();
// if the public key did not sign any revisions, drop it from // if the public key did not sign any revisions, drop it from
// the database as well // the database as well
try {
if (strlen($stdio->exec(array('select', 'k:' . $mtn_key_id))) == 0) { if (strlen($stdio->exec(array('select', 'k:' . $mtn_key_id))) == 0) {
$stdio->exec(array('drop_public_key', $mtn_key_id)); $stdio->exec(array('drop_public_key', $mtn_key_id));
} }
} catch (IDF_Scm_Exception $e) {
if (strpos($e->getMessage(), 'there is no key named') === false)
throw $e;
}
} }
} }