{
                let mut state = libpijul::RecordBuilder::new();
                if touched_files.is_empty() {
                    state.record(
                        txn.clone(),
                        libpijul::Algorithm::default(),
                        false,
                        &libpijul::DEFAULT_SEPARATOR,
                        channel.clone(),
                        &repo.working_copy,
                        &repo.changes,
                        "",
                        num_cpus::get(),
                    )?
                } else {
                    use canonical_path::CanonicalPathBuf;
                    fill_relative_prefixes(&mut touched_files)?;
                    repo.working_copy.record_prefixes(
                        txn.clone(),
                        channel.clone(),
                        &repo.changes,
                        &mut state,
                        CanonicalPathBuf::canonicalize(&repo.path)?,
                        &touched_files,
                        false,
                        num_cpus::get(),
                        0,
                    )?;
                }
                let rec = state.finish();
                if !rec.actions.is_empty() {
                    bail!("Applying this patch would delete unrecorded changes, aborting")
                }
            }