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VF32QC
let mut txn = l.pristine.mut_txn_begin()?;
let mut channel = txn.load_channel(&l.channel)?.unwrap();
txn.archive_with_state(&changes, &mut channel, &state, extra, &mut tarball, 0)?
let txn = l.pristine.arc_txn_begin()?;
let channel = {
let txn = txn.read();
txn.load_channel(&l.channel)?.unwrap()
};
txn.archive_with_state(&changes, &channel, &state, extra, &mut tarball, 0)?
impl<'a, W: std::io::Write, T: ChannelTxnT> Creditor<'a, W, T> {
pub fn new(w: W, txn: &'a T, channel: &'a T::Channel) -> Self {
impl<W: std::io::Write, T: ChannelTxnT> Creditor<W, T> {
pub fn new(w: W, txn: ArcTxn<T>, channel: ChannelRef<T>) -> Self {
let mut txn = repo.pristine.mut_txn_begin()?;
let channel_name = if let Some(ref c) = self.channel {
c
} else {
txn.current_channel().unwrap_or(crate::DEFAULT_CHANNEL)
let txn = repo.pristine.arc_txn_begin()?;
let channel = {
let txn = txn.read();
let channel_name = if let Some(ref c) = self.channel {
c
} else {
txn.current_channel().unwrap_or(crate::DEFAULT_CHANNEL)
};
txn.load_channel(&channel_name)?.unwrap()
let txn = repo.pristine.txn_begin()?;
let channel_name = if let Some(ref c) = self.channel {
c
} else {
txn.current_channel().unwrap_or(crate::DEFAULT_CHANNEL)
let txn = repo.pristine.arc_txn_begin()?;
let channel = {
let txn = txn.read();
let channel_name = if let Some(ref c) = self.channel {
c
} else {
txn.current_channel().unwrap_or(crate::DEFAULT_CHANNEL)
};
if let Some(channel) = txn.load_channel(&channel_name)? {
channel
} else {
bail!("No such channel: {:?}", channel_name);
}
let txn_ = txn.read();
let channel_ = channel.read();
let (former_parents, is_deleted, encoding) =
collect_former_parents::<C, W, T>(changes, &*txn_, &*channel_, vertex)?;
let (former_parents, is_deleted, encoding) = {
let txn_ = txn.read();
let channel_ = channel.read();
collect_former_parents::<C, W, T>(changes, &*txn_, &*channel_, vertex)?
};
{
let txn = txn.read();
let channel = channel.read();
alive::output_graph(changes, &*txn, &*channel, &mut f, &mut l, forward)
.map_err(PristineOutputError::from)?;
}
alive::output_graph(changes, &txn, &channel, &mut f, &mut l, forward)
.map_err(PristineOutputError::from)?;
let mut graph = crate::alive::retrieve(&*txn, txn.graph(&*channel), v0)?;
crate::alive::output_graph(changes, &*txn, &*channel, out, &mut graph, &mut forward)?;
let mut graph = {
let txn = txn.read();
let channel = channel.read();
crate::alive::retrieve(&*txn, txn.graph(&*channel), v0)?
};
crate::alive::output_graph(changes, txn, channel, out, &mut graph, &mut forward)?;
collect_children(
txn,
changes,
txn.graph(&channel),
Position::ROOT,
Inode::ROOT,
"",
None,
next_prefix_basename,
&mut files,
)?;
{
let txn_ = txn.read();
let channel_ = channel.read();
collect_children(
&*txn_,
changes,
txn_.graph(&channel_),
Position::ROOT,
Inode::ROOT,
"",
None,
next_prefix_basename,
&mut files,
)?;
}
b.sort_by(|u, v| {
txn.get_changeset(txn.changes(&channel), &u.0.change)
.unwrap()
.cmp(
&txn.get_changeset(txn.changes(&channel), &v.0.change)
.unwrap(),
)
});
{
let txn_ = txn.read();
let channel_ = channel.read();
b.sort_by(|u, v| {
txn_.get_changeset(txn_.changes(&channel_), &u.0.change)
.unwrap()
.cmp(
&txn_
.get_changeset(txn_.changes(&channel_), &v.0.change)
.unwrap(),
)
});
}
}
fn archive_with_state<P: changestore::ChangeStore, A: Archive>(
&mut self,
changes: &P,
channel: &mut pristine::ChannelRef<Self>,
state: &pristine::Merkle,
extra: &[pristine::Hash],
arch: &mut A,
salt: u64,
) -> Result<Vec<output::Conflict>, output::ArchiveError<P::Error, Self, A::Error>> {
self.archive_prefix_with_state(
changes,
channel,
state,
extra,
&mut std::iter::empty(),
arch,
salt,
)
}
/// Warning: this method unrecords changes until finding the
/// state. If this is not wanted, please fork the channel before
/// calling.
fn archive_prefix_with_state<
'a,
P: changestore::ChangeStore,
A: Archive,
I: Iterator<Item = &'a str>,
>(
&mut self,
changes: &P,
channel: &mut pristine::ChannelRef<Self>,
state: &pristine::Merkle,
extra: &[pristine::Hash],
prefix: &mut I,
arch: &mut A,
salt: u64,
) -> Result<Vec<output::Conflict>, output::ArchiveError<P::Error, Self, A::Error>> {
let mut unrecord = Vec::new();
let mut found = false;
for x in pristine::changeid_rev_log(self, &channel.read(), None)? {
let (_, p) = x?;
let m: Merkle = (&p.b).into();
if &m == state {
found = true;
break;
} else {
unrecord.push(p.a.into())
}
}
debug!("unrecord = {:?}", unrecord);
if found {
for h in unrecord.iter() {
let h = self.get_external(h)?.unwrap().into();
self.unrecord(changes, channel, &h, salt)?;
}
{
let mut channel_ = channel.write();
for app in extra.iter() {
self.apply_change_rec(changes, &mut channel_, app)?
}
}
output::archive(changes, self, channel, prefix, arch)
} else {
Err(output::ArchiveError::StateNotFound { state: *state })
}
fn archive<C: changestore::ChangeStore, A: Archive>(
fn iter_adjacent<'txn>(
&'txn self,
graph: &'txn Self::Channel,
key: Vertex<pristine::ChangeId>,
min_flag: pristine::EdgeFlags,
max_flag: pristine::EdgeFlags,
) -> Result<pristine::AdjacentIterator<'txn, Self>, pristine::TxnErr<Self::GraphError>> {
pristine::iter_adjacent(self, self.graph(graph), key, min_flag, max_flag)
}
}
impl<T: ChannelTxnT + TreeTxnT + DepsTxnT<DepsError = <T as GraphTxnT>::GraphError>> ArcTxn<T> {
pub fn archive<C: changestore::ChangeStore, A: Archive>(
}
}
impl<T: MutTxnT> ArcTxn<T> {
pub fn archive_with_state<P: changestore::ChangeStore, A: Archive>(
&self,
changes: &P,
channel: &pristine::ChannelRef<T>,
state: &pristine::Merkle,
extra: &[pristine::Hash],
arch: &mut A,
salt: u64,
) -> Result<Vec<output::Conflict>, output::ArchiveError<P::Error, T, A::Error>> {
self.archive_prefix_with_state(
changes,
channel,
state,
extra,
&mut std::iter::empty(),
arch,
salt,
)
fn iter_adjacent<'txn>(
&'txn self,
graph: &'txn Self::Channel,
key: Vertex<pristine::ChangeId>,
min_flag: pristine::EdgeFlags,
max_flag: pristine::EdgeFlags,
) -> Result<pristine::AdjacentIterator<'txn, Self>, pristine::TxnErr<Self::GraphError>> {
pristine::iter_adjacent(self, self.graph(graph), key, min_flag, max_flag)
/// Warning: this method unrecords changes until finding the
/// state. If this is not wanted, please fork the channel before
/// calling.
pub fn archive_prefix_with_state<
'a,
P: changestore::ChangeStore,
A: Archive,
I: Iterator<Item = &'a str>,
>(
&self,
changes: &P,
channel: &pristine::ChannelRef<T>,
state: &pristine::Merkle,
extra: &[pristine::Hash],
prefix: &mut I,
arch: &mut A,
salt: u64,
) -> Result<Vec<output::Conflict>, output::ArchiveError<P::Error, T, A::Error>> {
let mut unrecord = Vec::new();
let mut found = false;
let mut txn = self.write();
for x in pristine::changeid_rev_log(&*txn, &channel.read(), None)? {
let (_, p) = x?;
let m: Merkle = (&p.b).into();
if &m == state {
found = true;
break;
} else {
unrecord.push(p.a.into())
}
}
debug!("unrecord = {:?}", unrecord);
if found {
for h in unrecord.iter() {
let h = txn.get_external(h)?.unwrap().into();
unrecord::unrecord(&mut *txn, channel, changes, &h, salt)?;
}
{
let mut channel_ = channel.write();
for app in extra.iter() {
crate::apply::apply_change_rec(changes, &mut *txn, &mut channel_, app, false)?
}
}
std::mem::drop(txn);
output::archive(changes, self, channel, prefix, arch)
} else {
Err(output::ArchiveError::StateNotFound { state: *state })
}
graph.collect_forward_edges(txn, txn.graph(channel), &scc, &forward_scc, forward)?;
{
let txn = txn.read();
let channel = channel.read();
graph.collect_forward_edges(&*txn, txn.graph(&*channel), &scc, &forward_scc, forward)?;
}