[Aptitude-devel] r3228 - in branches/aptitude-0.3/aptitude: . src/cmdline

Daniel Burrows dburrows@costa.debian.org
Sun, 01 May 2005 14:53:35 +0000


Author: dburrows
Date: Sun May  1 14:53:32 2005
New Revision: 3228

Modified:
   branches/aptitude-0.3/aptitude/ChangeLog
   branches/aptitude-0.3/aptitude/src/cmdline/cmdline_resolver.cc
Log:
Add support for dumping the resolve state from the command-line.

Modified: branches/aptitude-0.3/aptitude/ChangeLog
==============================================================================
--- branches/aptitude-0.3/aptitude/ChangeLog	(original)
+++ branches/aptitude-0.3/aptitude/ChangeLog	Sun May  1 14:53:32 2005
@@ -1,5 +1,10 @@
 2005-05-01  Daniel Burrows  <dburrows@debian.org>
 
+	* src/cmdline/cmdline_resolver.cc:
+
+	  Add support for dumping the resolver state from the
+	  command-line. (enter a tilde)
+
 	* doc/en/aptitude.xml, src/defaults.cc, src/ui.cc:
 
 	  Add support for dumping the resolver state to a file from the

Modified: branches/aptitude-0.3/aptitude/src/cmdline/cmdline_resolver.cc
==============================================================================
--- branches/aptitude-0.3/aptitude/src/cmdline/cmdline_resolver.cc	(original)
+++ branches/aptitude-0.3/aptitude/src/cmdline/cmdline_resolver.cc	Sun May  1 14:53:32 2005
@@ -34,7 +34,10 @@
 
 #include <vscreen/fragment.h>
 
+#include <apt-pkg/error.h>
+
 #include <iostream>
+#include <fstream>
 
 using namespace std;
 
@@ -228,6 +231,21 @@
 					 to_remove, to_purge, verbose);
 		    modified_pkgs=true;
 		    break;
+		    // Undocumented debug feature:
+		  case '~':
+		    {
+		      string fn=prompt_string(_("File to write resolver state to: "));
+		      ofstream f(fn.c_str());
+		      if(!f)
+			_error->Errno("dump_resolver", _("Unable to open %s for writing"), fn.c_str());
+		      else
+			{
+			  (*apt_cache_file)->dump_resolver(f);
+			  if(!f)
+			    _error->Errno("dump_resolver", _("Error writing resolver state to %s"), fn.c_str());
+			}
+		    }
+		    break;
 		  default:
 		    cout << _("Invalid response; please enter one of the following commands:") << endl;
 		    resolver_help(cout);