]> git.saurik.com Git - apt.git/commitdiff
* lp:~mvo/apt/config-clear:
authorMichael Vogt <egon@debian-devbox>
Wed, 17 Oct 2012 08:29:52 +0000 (10:29 +0200)
committerMichael Vogt <mvo@debian.org>
Thu, 15 Aug 2013 07:39:27 +0000 (09:39 +0200)
  - support Configuration.Clear() for a clear of the entire
    configuration
Conflicts:
debian/changelog

apt-pkg/contrib/configuration.cc
apt-pkg/contrib/configuration.h
debian/changelog
test/libapt/configuration_test.cc

index 376617401fb995b98d7e59308104d3ef8fdb73c9..4ef4663c0cb659b0318042df5f14057544911f85 100644 (file)
@@ -420,6 +420,18 @@ void Configuration::Clear(string const &Name, string const &Value)
       }
    }
      
+}
+                                                                       /*}}}*/
+// Configuration::Clear - Clear everything                             /*{{{*/
+// ---------------------------------------------------------------------
+void Configuration::Clear()
+{
+   const Configuration::Item *Top = Tree(0);
+   while( Top != 0 )
+   {
+      Clear(Top->FullTag());
+      Top = Top->Next;
+   }
 }
                                                                        /*}}}*/
 // Configuration::Clear - Clear an entire tree                         /*{{{*/
index ea94c2fe6a9e70c32d77d52925f95ec5cadb8676..8e09ea0a698fd96055494c801cde8c2d876cae87 100644 (file)
@@ -94,6 +94,7 @@ class Configuration
 
    // clear a whole tree
    void Clear(const std::string &Name);
+   void Clear();
 
    // remove a certain value from a list (e.g. the list of "APT::Keep-Fds")
    void Clear(std::string const &List, std::string const &Value);
index 6172cb3323b5e8cb2e6e48c029f2336c0e1e4b4c..1c7afd863bef875146d59977026b9e31a1d53529 100644 (file)
@@ -5,6 +5,11 @@ apt (0.9.11) UNRELEASED; urgency=low
   * Show a error message if {,dist-}upgrade is used with additional
     arguments (closes: #705510)
 
+  [ Michael Vogt ]
+  * lp:~mvo/apt/config-clear:
+    - support Configuration.Clear() for a clear of the entire 
+      configuration
+
  -- Michael Vogt <michael.vogt@ubuntu.com>  Thu, 15 Aug 2013 09:27:35 +0200
 
 apt (0.9.10) unstable; urgency=low
index 87d5699effffe4d06e7628a184b873b940ece442..2c974ee0a9b6271ea2128320bd1a95285ee5ccf6 100644 (file)
@@ -98,6 +98,10 @@ int main(int argc,const char *argv[]) {
        equals(Cnf.FindDir("Dir::State"), "/rootdir/dev/null");
        equals(Cnf.FindDir("Dir::State::lists"), "/rootdir/dev/null");
 
+        Cnf.Set("Moo::Bar", "1");
+        Cnf.Clear();
+        equals(Cnf.Find("Moo::Bar"), "");
+
        //FIXME: Test for configuration file parsing;
        // currently only integration/ tests test them implicitly