[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#151540: dselect: "panic button" to set all selections back to whatever's currently installed



Package: dselect
Version: 1.10
Severity: wishlist
Tags: patch

I spent some time on IRC today talking to a user who had messed up his
selections very badly in dselect and who had then mistakenly hit Enter.
Having done so, he was having great difficulty getting back to a sane
state: what he really wanted to do was to revert to what was currently
installed on his system, since he knew that was sensible. He expressed a
desire to "just remove dselect's todo cache".

However, we both had great difficulty getting dselect back to this
state. Hitting +, -, and _ on headings does part of the work, but it
tends to throw up conflict resolution screens along the way, and since
the user's installed state had no conflicts he didn't really want to
wade through those. I later noticed the unhold function, but it doesn't
appear to work on the "All packages" heading, and in any case it's a
little obscure.

I felt that there really ought to be an easier way to do this, analogous
to the 'R', 'U', and 'D' keystrokes which are plainly visible in the
help screen as ways to get out of trouble. Here's a patch which
implements 'C', "Set all to Currently installed state"; the intent is
that, with the exception of any partially installed packages, pressing
'C' then Enter should always result in [I]nstall having nothing to do,
regardless of whether any contrary selections have been established
beforehand.

Index: dselect/bindings.cc
===================================================================
RCS file: /cvs/dpkg/dpkg/dselect/bindings.cc,v
retrieving revision 1.6
diff -p -u -r1.6 bindings.cc
--- dselect/bindings.cc	2002/05/06 16:18:15	1.6
+++ dselect/bindings.cc	2002/06/30 22:44:47
@@ -156,6 +156,7 @@ const keybindings::description keybindin
   { "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")          },
Index: dselect/dselect.8
===================================================================
RCS file: /cvs/dpkg/dpkg/dselect/dselect.8,v
retrieving revision 1.8
diff -p -u -r1.8 dselect.8
--- dselect/dselect.8	2001/07/16 22:39:24	1.8
+++ dselect/dselect.8	2002/06/30 22:44:48
@@ -409,6 +409,13 @@ keys, any possibly detrimental changes t
 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
 .B dselect
Index: dselect/helpmsgs.src
===================================================================
RCS file: /cvs/dpkg/dpkg/dselect/helpmsgs.src,v
retrieving revision 1.4
diff -p -u -r1.4 helpmsgs.src
--- dselect/helpmsgs.src	2001/07/16 11:31:00	1.4
+++ dselect/helpmsgs.src	2002/06/30 22:44:48
@@ -22,6 +22,7 @@ Quit, exit, overwrite (note capitals!): 
    R     Revert to state before this list      ^l   redraw display
    U     set all to sUggested state             /   search (Return to cancel)
    D     set all to Directly requested state    \\   repeat last search
+   C     set all to Currently installed state
 
 @@@ mainintro Introduction to package selections
 
Index: dselect/pkgcmds.cc
===================================================================
RCS file: /cvs/dpkg/dpkg/dselect/pkgcmds.cc,v
retrieving revision 1.9
diff -p -u -r1.9 pkgcmds.cc
--- dselect/pkgcmds.cc	2002/05/06 16:18:15	1.9
+++ dselect/pkgcmds.cc	2002/06/30 22:44:48
@@ -262,6 +262,16 @@ void packagelist::kd_revertsuggest() {
   refreshlist(); redrawthisstate();
 }
 
+void packagelist::kd_revertinstalled() {
+  int index;
+  for (index=0; index<nitems; index++) {
+    if (table[index]->pkg->name)
+      table[index]->selected= reallywant(pkginfo::want_sentinel,table[index]);
+    ldrawnstart= ldrawnend= -1;
+  }
+  refreshlist(); redrawthisstate();
+}
+
 /* fixme: configurable purge/deselect */
 
 void packagelist::kd_toggleinfo() {
Index: dselect/pkgkeys.cc
===================================================================
RCS file: /cvs/dpkg/dpkg/dselect/pkgkeys.cc,v
retrieving revision 1.7
diff -p -u -r1.7 pkgkeys.cc
--- dselect/pkgkeys.cc	2002/05/06 16:18:15	1.7
+++ dselect/pkgkeys.cc	2002/06/30 22:44:48
@@ -70,6 +70,7 @@ const keybindings::interpretation packag
   { "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           }
 };
 
@@ -142,6 +143,7 @@ const keybindings::orgbinding packagelis
   { 'R',            "revert"           },
   { 'U',            "revertsuggest"    },
   { 'D',            "revertdirect"     },
+  { 'C',            "revertinstalled"  },
                                        
   {  -1,             0                 }
 };
Index: dselect/pkglist.h
===================================================================
RCS file: /cvs/dpkg/dpkg/dselect/pkglist.h,v
retrieving revision 1.6
diff -p -u -r1.6 pkglist.h
--- dselect/pkglist.h	2002/05/06 16:18:15	1.6
+++ dselect/pkglist.h	2002/06/30 22:44:48
@@ -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();

Thanks,

-- 
Colin Watson                                  [cjwatson@flatline.org.uk]


-- 
To UNSUBSCRIBE, email to debian-dpkg-request@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org



Reply to: