Author: jsuchome Date: Mon Feb 28 10:38:02 2011 New Revision: 63490 URL: http://svn.opensuse.org/viewcvs/yast?rev=63490&view=rev Log: - added option to compare with arbitrary snapshot Modified: branches/tmp/jsuchome/snapper/package/yast2-snapper.changes branches/tmp/jsuchome/snapper/src/Snapper.ycp branches/tmp/jsuchome/snapper/src/dialogs.ycp Modified: branches/tmp/jsuchome/snapper/package/yast2-snapper.changes URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/jsuchome/snapper/package/yast2-snapper.changes?rev=63490&r1=63489&r2=63490&view=diff ============================================================================== --- branches/tmp/jsuchome/snapper/package/yast2-snapper.changes (original) +++ branches/tmp/jsuchome/snapper/package/yast2-snapper.changes Mon Feb 28 10:38:02 2011 @@ -1,4 +1,9 @@ ------------------------------------------------------------------- +Mon Feb 28 10:37:40 CET 2011 - jsuchome@suse.cz + +- added option to compare with arbitrary snapshot + +------------------------------------------------------------------- Thu Feb 24 14:37:00 CET 2011 - jsuchome@suse.cz - tree handling in YCP Modified: branches/tmp/jsuchome/snapper/src/Snapper.ycp URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/jsuchome/snapper/src/Snapper.ycp?rev=63490&r1=63489&r2=63490&view=diff ============================================================================== --- branches/tmp/jsuchome/snapper/src/Snapper.ycp (original) +++ branches/tmp/jsuchome/snapper/src/Snapper.ycp Mon Feb 28 10:38:02 2011 @@ -74,6 +74,8 @@ if (new == 0) file2 = file; + y2milestone ("comparing '%1' and '%2'", file1, file2); + if (FileUtils::Exists (file1) && FileUtils::Exists (file2)) { @@ -101,6 +103,10 @@ { ret["status"] = "created"; } + else + { + ret["status"] = "none"; + } return ret; } @@ -117,7 +123,7 @@ integer id = snapshot["num"]:0; if (id == 0) return; // ignore the 'current system' snapshot["name"] = tostring (id); - y2internal ("snapshot data: %1", snapshot); + y2debug ("snapshot data: %1", snapshot); snapshots = add (snapshots, snapshot); id2index[id] = i; i = i + 1; @@ -185,7 +191,7 @@ string orig = sformat ("%1/%2/snapshot%3", snapshots_path, snapshot_num, file); string dir = substring (file, 0, findlastof (file, "/")); - y2internal ("copying file %1 to %2 (dir: %3)", orig, file, dir); + y2milestone ("copying file %1 to %2 (dir: %3)", orig, file, dir); if (FileUtils::CheckAndCreatePath (dir)) { SCR::Execute (.target.bash, sformat ("/bin/cp %1 %2", orig, file)); Modified: branches/tmp/jsuchome/snapper/src/dialogs.ycp URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/jsuchome/snapper/src/dialogs.ycp?rev=63490&r1=63489&r2=63490&view=diff ============================================================================== --- branches/tmp/jsuchome/snapper/src/dialogs.ycp (original) +++ branches/tmp/jsuchome/snapper/src/dialogs.ycp Mon Feb 28 10:38:02 2011 @@ -187,6 +187,15 @@ string pre_date = timestring ("%c", Snapper::snapshots[pre_index,"date"]:0, false); string date = timestring ("%c", snapshot["date"]:0, false); symbol type = snapshot["type"]:`NONE; + list<term> combo_items = []; + foreach (map s, Snapper::snapshots, { + integer id = s["num"]:0; + if (id != snapshot_num) + { + // '%1: %2' means 'ID: description', adapt the order if necessary + combo_items = add (combo_items, `item (`id (id), sformat (_("%1: %2"), id, s["description"]:""))); + } + }); if (!haskey (snapshot, "files")) { @@ -304,6 +313,11 @@ // label content = add (content, `Left (`Heading ("File was not changed"))); } + else if (modification["status"]:"" == "none") + { + // label + content = add (content, `Left (`Heading ("File does not exist in either snapshot"))); + } else { y2warning ("not known: %1", modification); @@ -331,11 +345,25 @@ { UI::ReplaceWidget (`id (`diff_chooser), `HBox (`HSpacing (0.5), `VBox ( `VSpacing (0.2), - // label (above richtext) - `Left (`Label (_("Showing the difference between snapshot and current system"))), + `RadioButtonGroup (`id(`rd), `Left (`HVSquash (`VBox ( + `Left (`RadioButton (`id(`diff_snapshot), `opt (`notify), + // radio button label + _("Show the difference between snapshot and current system"), true)), + `VBox ( + `Left (`RadioButton (`id (`diff_arbitrary), `opt (`notify), + // radio button label, snapshot selection will follow + _("Show the difference between current and selected snapshot:"), false) + ), + `HBox ( + `HSpacing (2), + `Left (`ComboBox (`id (`selection_snapshots), `opt (`notify), "", combo_items)) + ) + ) + )))), `VSpacing () ), `HSpacing (0.5))); show_file_modification (current_file, snapshot_num, 0); + UI::ChangeWidget (`id (`selection_snapshots), `Enabled, false); } else { @@ -525,7 +553,21 @@ } else if (ret == `diff_snapshot) { - show_file_modification (current_file, previous_num, snapshot_num); + if (type == `SINGLE) + { + UI::ChangeWidget (`id (`selection_snapshots), `Enabled, false); + show_file_modification (current_file, snapshot_num, 0); + } + else + { + show_file_modification (current_file, previous_num, snapshot_num); + } + } + else if (ret == `diff_arbitrary || ret == `selection_snapshots) + { + UI::ChangeWidget (`id (`selection_snapshots), `Enabled, true); + integer selected_num = (integer) UI::QueryWidget (`id (`selection_snapshots), `Value); + show_file_modification (current_file, previous_num, selected_num); } else if (ret == `diff_pre_current) { -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org