From 1dcbcf5299120544ebb01e7ab442d24409bd4974 Mon Sep 17 00:00:00 2001 From: Clemens Lang Date: Tue, 23 Jul 2024 15:19:45 +0200 Subject: [PATCH] snapshot: Report match in --diff if there are no changes The user experience of 'sudo port snapshot --diff $id --all' just printing nothing is not great. Improve this by explicitly printing a success message if there are no changes. (cherry picked from commit 35e8fc4d39a671e89136c26237483a3b1d4a10c3) --- src/macports1.0/snapshot.tcl | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/macports1.0/snapshot.tcl b/src/macports1.0/snapshot.tcl index 53ff52626d..50f943522f 100644 --- a/src/macports1.0/snapshot.tcl +++ b/src/macports1.0/snapshot.tcl @@ -141,6 +141,7 @@ namespace eval snapshot { } } } + if {[llength $diff(removed)] > 0} { append note "The following ports are in the snapshot but not installed:\n" foreach removed_port [lsort -ascii -index 0 $diff(removed)] { @@ -169,6 +170,10 @@ namespace eval snapshot { } } + if {[llength $diff(added)] == 0 && [llength $diff(removed)] == 0 && [llength $diff(changed)] == 0} { + append note "The current state and the specified snapshot match.\n" + } + ui_msg [string trimright $note "\n"] return 0 }