From: Colin Watson Date: Mon, 21 Jan 2008 09:19:01 +0000 (+0200) Subject: dselect: New key to set all selections back to what's currently installed X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=48b0b1e23c86beec6199bbe06e46a5a43c2d1cb5;p=dpkg dselect: New key to set all selections back to what's currently installed Closes: #151540 --- diff --git a/ChangeLog b/ChangeLog index 5b48aacd..bc921b2b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2008-01-21 Colin Watson + + * dselect/pkgkeys.cc (packagelist_korgbindings): Add 'C'. + (packagelist_kinterps): Add 'revertinstalled'. + * dselect/bindings.cc (keybindings::descriptions): Likewise. + * dselect/pkglist.h (class packagelist): Add kd_revertinstalled. + * dselect/pkgcmds.cc (packagelist::kd_revertinstalled): New method. + * man/dselect.1: Document new 'C' keybinding. + 2008-01-21 Guillem Jover * dpkg-deb/build.c (getfi): Use m_malloc instead of malloc. diff --git a/debian/changelog b/debian/changelog index fa4a629e..c5d895fc 100644 --- a/debian/changelog +++ b/debian/changelog @@ -3,6 +3,9 @@ dpkg (1.14.17) UNRELEASED; urgency=low [ Guillem Jover ] * Replace strdup plus error checking usage with a new m_strdup function. Closes: #379028 + * Add new keybinding in dselect to restore all selections back to + whatever's currently installed. Closes: #151540 + Thanks to Colin Watson. -- Guillem Jover Mon, 21 Jan 2008 10:11:55 +0200 diff --git a/dselect/bindings.cc b/dselect/bindings.cc index 444c6609..d6f32a74 100644 --- a/dselect/bindings.cc +++ b/dselect/bindings.cc @@ -158,6 +158,7 @@ const keybindings::description keybindings::descriptions[]= { { "revert", N_("Revert to old state for all packages") }, { "revertsuggest", N_("Revert to suggested state for all packages") }, { "revertdirect", N_("Revert to directly requested state for all packages") }, + { "revertinstalled", N_("Revert to currently installed state for all packages") }, // Actions which apply only to lists of methods. { "select-and-quit", N_("Select currently-highlighted access method") }, diff --git a/dselect/pkgcmds.cc b/dselect/pkgcmds.cc index 14a95c79..32744c89 100644 --- a/dselect/pkgcmds.cc +++ b/dselect/pkgcmds.cc @@ -264,6 +264,21 @@ void packagelist::kd_revertsuggest() { refreshlist(); redrawthisstate(); } +void +packagelist::kd_revertinstalled() +{ + int i; + + for (i = 0; i < nitems; i++) { + if (table[i]->pkg->name) + table[i]->selected = reallywant(pkginfo::want_sentinel, table[i]); + ldrawnstart = ldrawnend = -1; + } + + refreshlist(); + redrawthisstate(); +} + /* fixme: configurable purge/deselect */ void packagelist::kd_toggleinfo() { diff --git a/dselect/pkgkeys.cc b/dselect/pkgkeys.cc index 98029e74..0b249eb7 100644 --- a/dselect/pkgkeys.cc +++ b/dselect/pkgkeys.cc @@ -72,6 +72,7 @@ const keybindings::interpretation packagelist_kinterps[] = { { "revert", 0, &packagelist::kd_revert_abort, qa_noquit }, { "revertsuggest", 0, &packagelist::kd_revertsuggest, qa_noquit }, { "revertdirect", 0, &packagelist::kd_revertdirect, qa_noquit }, + { "revertinstalled", 0, &packagelist::kd_revertinstalled, qa_noquit }, { 0, 0, 0, qa_noquit } }; @@ -144,6 +145,7 @@ const keybindings::orgbinding packagelist_korgbindings[]= { { 'R', "revert" }, { 'U', "revertsuggest" }, { 'D', "revertdirect" }, + { 'C', "revertinstalled" }, { -1, 0 } }; diff --git a/dselect/pkglist.h b/dselect/pkglist.h index 25a5cf3f..89ff8277 100644 --- a/dselect/pkglist.h +++ b/dselect/pkglist.h @@ -183,6 +183,7 @@ protected: void kd_revert_abort(); void kd_revertsuggest(); void kd_revertdirect(); + void kd_revertinstalled(); void kd_morespecific(); void kd_lessspecific(); void kd_swaporder(); diff --git a/man/dselect.1 b/man/dselect.1 index 3f6dd0c7..03e11d2c 100644 --- a/man/dselect.1 +++ b/man/dselect.1 @@ -423,6 +423,13 @@ keys, any possibly detrimental changes to the requested package selections can be backed out completely to the last established settings. .sp +If you mistakenly establish some settings and wish to revert all the +selections to what is currently installed on the system, press the +\fB'C'\fP key. +This is somewhat similar to using the unhold command on all packages, +but provides a more obvious panic button in cases where the user +pressed \fBenter\fP by accident. +.sp . .SH BUGS The