@@ -2391,13 +2391,7 @@ impl LockedWorkingCopy for LockedLocalWorkingCopy {
2391
2391
& mut self ,
2392
2392
options : & SnapshotOptions ,
2393
2393
) -> Result < ( MergedTreeId , SnapshotStats ) , SnapshotError > {
2394
- let tree_state = self
2395
- . wc
2396
- . tree_state_mut ( )
2397
- . map_err ( |err| SnapshotError :: Other {
2398
- message : "Failed to read the working copy state" . to_string ( ) ,
2399
- err : err. into ( ) ,
2400
- } ) ?;
2394
+ let tree_state = self . wc . tree_state_mut ( ) ?;
2401
2395
let ( is_dirty, stats) = tree_state. snapshot ( options) ?;
2402
2396
self . tree_state_dirty |= is_dirty;
2403
2397
Ok ( ( tree_state. current_tree_id ( ) . clone ( ) , stats) )
@@ -2411,13 +2405,7 @@ impl LockedWorkingCopy for LockedLocalWorkingCopy {
2411
2405
// TODO: Write a "pending_checkout" file with the new TreeId so we can
2412
2406
// continue an interrupted update if we find such a file.
2413
2407
let new_tree = commit. tree ( ) ?;
2414
- let tree_state = self
2415
- . wc
2416
- . tree_state_mut ( )
2417
- . map_err ( |err| CheckoutError :: Other {
2418
- message : "Failed to load the working copy state" . to_string ( ) ,
2419
- err : err. into ( ) ,
2420
- } ) ?;
2408
+ let tree_state = self . wc . tree_state_mut ( ) ?;
2421
2409
if tree_state. tree_id != * commit. tree_id ( ) {
2422
2410
let stats = tree_state. check_out ( & new_tree, options) ?;
2423
2411
self . tree_state_dirty = true ;
@@ -2433,28 +2421,14 @@ impl LockedWorkingCopy for LockedLocalWorkingCopy {
2433
2421
2434
2422
fn reset ( & mut self , commit : & Commit ) -> Result < ( ) , ResetError > {
2435
2423
let new_tree = commit. tree ( ) ?;
2436
- self . wc
2437
- . tree_state_mut ( )
2438
- . map_err ( |err| ResetError :: Other {
2439
- message : "Failed to read the working copy state" . to_string ( ) ,
2440
- err : err. into ( ) ,
2441
- } ) ?
2442
- . reset ( & new_tree)
2443
- . block_on ( ) ?;
2424
+ self . wc . tree_state_mut ( ) ?. reset ( & new_tree) . block_on ( ) ?;
2444
2425
self . tree_state_dirty = true ;
2445
2426
Ok ( ( ) )
2446
2427
}
2447
2428
2448
2429
fn recover ( & mut self , commit : & Commit ) -> Result < ( ) , ResetError > {
2449
2430
let new_tree = commit. tree ( ) ?;
2450
- self . wc
2451
- . tree_state_mut ( )
2452
- . map_err ( |err| ResetError :: Other {
2453
- message : "Failed to read the working copy state" . to_string ( ) ,
2454
- err : err. into ( ) ,
2455
- } ) ?
2456
- . recover ( & new_tree)
2457
- . block_on ( ) ?;
2431
+ self . wc . tree_state_mut ( ) ?. recover ( & new_tree) . block_on ( ) ?;
2458
2432
self . tree_state_dirty = true ;
2459
2433
Ok ( ( ) )
2460
2434
}
@@ -2472,11 +2446,7 @@ impl LockedWorkingCopy for LockedLocalWorkingCopy {
2472
2446
// continue an interrupted update if we find such a file.
2473
2447
let stats = self
2474
2448
. wc
2475
- . tree_state_mut ( )
2476
- . map_err ( |err| CheckoutError :: Other {
2477
- message : "Failed to load the working copy state" . to_string ( ) ,
2478
- err : err. into ( ) ,
2479
- } ) ?
2449
+ . tree_state_mut ( ) ?
2480
2450
. set_sparse_patterns ( new_sparse_patterns, options) ?;
2481
2451
self . tree_state_dirty = true ;
2482
2452
Ok ( stats)
@@ -2511,13 +2481,7 @@ impl LockedWorkingCopy for LockedLocalWorkingCopy {
2511
2481
2512
2482
impl LockedLocalWorkingCopy {
2513
2483
pub fn reset_watchman ( & mut self ) -> Result < ( ) , SnapshotError > {
2514
- self . wc
2515
- . tree_state_mut ( )
2516
- . map_err ( |err| SnapshotError :: Other {
2517
- message : "Failed to read the working copy state" . to_string ( ) ,
2518
- err : err. into ( ) ,
2519
- } ) ?
2520
- . reset_watchman ( ) ;
2484
+ self . wc . tree_state_mut ( ) ?. reset_watchman ( ) ;
2521
2485
self . tree_state_dirty = true ;
2522
2486
Ok ( ( ) )
2523
2487
}
0 commit comments