Simplify return type for remote get_id

ammkrn
Jul 27, 2021, 4:55 PM
C5XGFNKIX3RM6KOKRYTECBDDRDAE33JWIVJAJJTEFKFXQNXHEKHQC

Dependencies

  • [2] EUZFFJSO Updating Pijul with the latest changes in Libpijul
  • [3] CCLLB7OI Upgrading to Sanakirja 0.15 + version bump
  • [4] MU5GSJAW Partial push and pull (WARNING: breaks the existing protocol)
  • [5] KI2AFWOS Fixing a panic in pull
  • [6] FE5ES6Q4 Stop pushing/pulling if the remote returns an error
  • [7] SXEYMYF7 Fixing the bad changes in history (unfortunately, by rebooting).
  • [8] A3RM526Y Integrating identity malleability
  • [9] 76PCXGML Pushing to, and pulling from the local repository
  • [10] UDHP4ZVB Fixing SSH asynchronicity issues
  • [11] K6GWUOD5 Styling progress bars
  • [12] L2VH4BYK Downloading changelists from channels without an id (Nest discussions)
  • [13] FGVTXN52 Filter linebreak from http::get_state() response
  • [*] FBXYP7QM Forgot to add remote::http

Change contents

  • replacement in pijul/src/remote/ssh.rs at line 738
    [3.37998][3.3927:4027]()
    pub async fn get_id(&mut self) -> Result<Option<libpijul::pristine::RemoteId>, anyhow::Error> {
    [3.37998]
    [3.4027]
    pub async fn get_id(&mut self) -> Result<libpijul::pristine::RemoteId, anyhow::Error> {
  • replacement in pijul/src/remote/ssh.rs at line 747
    [3.4320][3.4320:4348]()
    Ok(receiver.await?)
    [3.4320]
    [3.4348]
    receiver
    .await?
    .ok_or_else(|| anyhow::anyhow!("Unable to retrieve RemoteId for Ssh remote"))
  • replacement in pijul/src/remote/mod.rs at line 169
    [3.56888][3.6335:6411](),[3.6411][3.1579:1636](),[3.1579][3.1579:1636]()
    let id = if let Some(id) = self.get_id(txn).await? {
    id
    } else {
    return Ok(None);
    };
    [3.56888]
    [3.6412]
    let id = self.get_id(txn).await?;
  • replacement in pijul/src/remote/mod.rs at line 265
    [3.6730][3.6730:6801]()
    ) -> Result<Option<libpijul::pristine::RemoteId>, anyhow::Error> {
    [3.6730]
    [3.6801]
    ) -> Result<libpijul::pristine::RemoteId, anyhow::Error> {
  • replacement in pijul/src/remote/mod.rs at line 272
    [3.7116][2.385:441]()
    Ok(Some(*txn.id(&*channel.read())))
    [3.7116]
    [3.2110]
    Ok(*txn.id(&*channel.read()))
  • replacement in pijul/src/remote/mod.rs at line 274
    [3.2135][3.2135:2164]()
    Ok(None)
    [3.2135]
    [3.2164]
    Err(anyhow::anyhow!(
    "Unable to retrieve RemoteId for LocalChannel remote"
    ))
  • replacement in pijul/src/remote/mod.rs at line 628
    [3.73272][3.7991:8042]()
    let id = self.get_id(txn).await?.unwrap();
    [3.73272]
    [3.73272]
    let id = self.get_id(txn).await?;
  • replacement in pijul/src/remote/local.rs at line 41
    [3.80605][3.8610:8700]()
    pub fn get_id(&self) -> Result<Option<libpijul::pristine::RemoteId>, anyhow::Error> {
    [3.80605]
    [3.8700]
    pub fn get_id(&self) -> Result<libpijul::pristine::RemoteId, anyhow::Error> {
  • replacement in pijul/src/remote/local.rs at line 44
    [3.8812][2.1009:1057]()
    Ok(Some(*txn.id(&*channel.read())))
    [3.8812]
    [3.8869]
    Ok(*txn.id(&*channel.read()))
  • replacement in pijul/src/remote/local.rs at line 46
    [3.8886][3.8886:8907]()
    Ok(None)
    [3.8886]
    [3.8907]
    Err(anyhow::anyhow!(
    "Unable to retrieve RemoteId for Local remote"
    ))
  • replacement in pijul/src/remote/http.rs at line 295
    [3.1310][3.10442:10538]()
    pub async fn get_id(&self) -> Result<Option<libpijul::pristine::RemoteId>, anyhow::Error> {
    [3.1310]
    [3.10538]
    pub async fn get_id(&self) -> Result<libpijul::pristine::RemoteId, anyhow::Error> {
  • replacement in pijul/src/remote/http.rs at line 311
    [3.11088][3.11088:11148]()
    Ok(libpijul::pristine::RemoteId::from_bytes(&resp))
    [3.11088]
    [3.11148]
    libpijul::pristine::RemoteId::from_bytes(&resp)
    .ok_or_else(|| anyhow::anyhow!("Unable to retrieve RemoteId for Http remote"))