@@ -2370,13 +2370,7 @@ impl LockedWorkingCopy for LockedLocalWorkingCopy {
2370
2370
& mut self ,
2371
2371
options : & SnapshotOptions ,
2372
2372
) -> Result < ( MergedTreeId , SnapshotStats ) , SnapshotError > {
2373
- let tree_state = self
2374
- . wc
2375
- . tree_state_mut ( )
2376
- . map_err ( |err| SnapshotError :: Other {
2377
- message : "Failed to read the working copy state" . to_string ( ) ,
2378
- err : err. into ( ) ,
2379
- } ) ?;
2373
+ let tree_state = self . wc . tree_state_mut ( ) ?;
2380
2374
let ( is_dirty, stats) = tree_state. snapshot ( options) ?;
2381
2375
self . tree_state_dirty |= is_dirty;
2382
2376
Ok ( ( tree_state. current_tree_id ( ) . clone ( ) , stats) )
@@ -2386,13 +2380,7 @@ impl LockedWorkingCopy for LockedLocalWorkingCopy {
2386
2380
// TODO: Write a "pending_checkout" file with the new TreeId so we can
2387
2381
// continue an interrupted update if we find such a file.
2388
2382
let new_tree = commit. tree ( ) ?;
2389
- let tree_state = self
2390
- . wc
2391
- . tree_state_mut ( )
2392
- . map_err ( |err| CheckoutError :: Other {
2393
- message : "Failed to load the working copy state" . to_string ( ) ,
2394
- err : err. into ( ) ,
2395
- } ) ?;
2383
+ let tree_state = self . wc . tree_state_mut ( ) ?;
2396
2384
if tree_state. tree_id != * commit. tree_id ( ) {
2397
2385
let stats = tree_state. check_out ( & new_tree) ?;
2398
2386
self . tree_state_dirty = true ;
@@ -2408,28 +2396,14 @@ impl LockedWorkingCopy for LockedLocalWorkingCopy {
2408
2396
2409
2397
fn reset ( & mut self , commit : & Commit ) -> Result < ( ) , ResetError > {
2410
2398
let new_tree = commit. tree ( ) ?;
2411
- self . wc
2412
- . tree_state_mut ( )
2413
- . map_err ( |err| ResetError :: Other {
2414
- message : "Failed to read the working copy state" . to_string ( ) ,
2415
- err : err. into ( ) ,
2416
- } ) ?
2417
- . reset ( & new_tree)
2418
- . block_on ( ) ?;
2399
+ self . wc . tree_state_mut ( ) ?. reset ( & new_tree) . block_on ( ) ?;
2419
2400
self . tree_state_dirty = true ;
2420
2401
Ok ( ( ) )
2421
2402
}
2422
2403
2423
2404
fn recover ( & mut self , commit : & Commit ) -> Result < ( ) , ResetError > {
2424
2405
let new_tree = commit. tree ( ) ?;
2425
- self . wc
2426
- . tree_state_mut ( )
2427
- . map_err ( |err| ResetError :: Other {
2428
- message : "Failed to read the working copy state" . to_string ( ) ,
2429
- err : err. into ( ) ,
2430
- } ) ?
2431
- . recover ( & new_tree)
2432
- . block_on ( ) ?;
2406
+ self . wc . tree_state_mut ( ) ?. recover ( & new_tree) . block_on ( ) ?;
2433
2407
self . tree_state_dirty = true ;
2434
2408
Ok ( ( ) )
2435
2409
}
@@ -2446,11 +2420,7 @@ impl LockedWorkingCopy for LockedLocalWorkingCopy {
2446
2420
// continue an interrupted update if we find such a file.
2447
2421
let stats = self
2448
2422
. wc
2449
- . tree_state_mut ( )
2450
- . map_err ( |err| CheckoutError :: Other {
2451
- message : "Failed to load the working copy state" . to_string ( ) ,
2452
- err : err. into ( ) ,
2453
- } ) ?
2423
+ . tree_state_mut ( ) ?
2454
2424
. set_sparse_patterns ( new_sparse_patterns) ?;
2455
2425
self . tree_state_dirty = true ;
2456
2426
Ok ( stats)
@@ -2485,13 +2455,7 @@ impl LockedWorkingCopy for LockedLocalWorkingCopy {
2485
2455
2486
2456
impl LockedLocalWorkingCopy {
2487
2457
pub fn reset_watchman ( & mut self ) -> Result < ( ) , SnapshotError > {
2488
- self . wc
2489
- . tree_state_mut ( )
2490
- . map_err ( |err| SnapshotError :: Other {
2491
- message : "Failed to read the working copy state" . to_string ( ) ,
2492
- err : err. into ( ) ,
2493
- } ) ?
2494
- . reset_watchman ( ) ;
2458
+ self . wc . tree_state_mut ( ) ?. reset_watchman ( ) ;
2495
2459
self . tree_state_dirty = true ;
2496
2460
Ok ( ( ) )
2497
2461
}
0 commit comments