Add a little more structure to the code, introduce a run() function returning a Result, so we can use ? instead of .unwrap() in a few places.
Put the printing of identified conflicts into its own function, I expect that it'll grow much larger.
DF2KXDEK7B5ADHJYG7RUAZPTHUVUOLCLQLUUUIZP2OMJRRAKJJIQC
ZXGWSXWJPY64MV7HXBFZTUVCXEFPM5VBNYGSZI5ANIDKK54GY65QC
ISUKIWVPGBA7ITNBPSAACNOB4FLAIMSCP7A6I33XE5UITW7M7GYAC
C5ZEXJ6ZBETDLSNRE7IPXMRNQARLRKK3Y275T2VYJ74TISJOV6OAC
JNHJLQE6TQDFL2L3S2K5FSRT4FAGDC3Z57MXV2ARP33JGSS2ZPIAC
VJ5MYXCEDWECE2TAIJOTGDVZXWQ6QQLWERXCD7B7U734VD3ND73QC
Z6LX5GLZIQNQMBLBS3YEILPVHKLHZQCXWE5NDYCWO5SCMTWXBGMQC
M22GG4742DVYGENDLQSA4QUG6FHTOCVRQ3PJVNB7Y4SZBXJBFH5QC
fn main() {
let repo = Repository::find_root(None).unwrap();
let txn = repo.pristine.arc_txn_begin().unwrap();
fn run() -> Result<(), anyhow::Error> {
let repo = Repository::find_root(None)?;
let txn = repo.pristine.arc_txn_begin()?;
conflicts.extend(
libpijul::output::output_repository_no_pending(
&fake_working_copy,
&repo.changes,
&txn,
&channel,
"", // prefix?
true, //
None,
num_cpus::get(),
0,
)
.unwrap(),
);
if conflicts.is_empty() {
return;
conflicts.extend(libpijul::output::output_repository_no_pending(
&FakeWorkingCopy,
&repo.changes,
&txn,
&channel,
"", // prefix?
true, //
None,
num_cpus::get(),
0,
)?);
if !conflicts.is_empty() {
print_conflicts(conflicts);
[Order { path: "file.txt", inode_vertex: [Position { change: ChangeId(XEV3C5VQ6YGEO), pos: ChangePosition(L64(1)) }], line: 2, changes: [YNHLT3DHY7YAIAUM4LH2O4DPZURDPHH6FB5MVPANYMFZXLY47ABQC, LB3DIKQ2M7XPJBXB2FGR5U2APBQN7P7BN7A5OKXBGHGOMDFWEPPAC], id: 1 }]
Conflicts
order file.txt