Hello community, here is the log from the commit of package snapper for openSUSE:Factory checked in at 2014-10-08 22:13:30 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/snapper (Old) and /work/SRC/openSUSE:Factory/.snapper.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "snapper" Changes: -------- --- /work/SRC/openSUSE:Factory/snapper/snapper.changes 2014-10-05 20:31:09.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.snapper.new/snapper.changes 2014-10-08 22:13:38.000000000 +0200 @@ -1,0 +2,6 @@ +Fri Oct 3 01:05:01 CEST 2014 - [email protected] + +- add option --all-configs to snapper client, list snapshots from + all accessible configs + +------------------------------------------------------------------- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ snapper-0.2.4.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/snapper-0.2.4/client/snapper.cc new/snapper-0.2.4/client/snapper.cc --- old/snapper-0.2.4/client/snapper.cc 2014-10-02 15:46:25.000000000 +0200 +++ new/snapper-0.2.4/client/snapper.cc 2014-10-06 10:44:19.000000000 +0200 @@ -140,6 +140,32 @@ } +list<pair<string, string> > +enum_configs(DBus::Connection* conn) +{ + list<pair<string, string> > configs; + + if (no_dbus) + { + list<ConfigInfo> config_infos = Snapper::getConfigs(); + for (list<ConfigInfo>::const_iterator it = config_infos.begin(); it != config_infos.end(); ++it) + { + configs.push_back(make_pair(it->getConfigName(), it->getSubvolume())); + } + } + else + { + list<XConfigInfo> config_infos = command_list_xconfigs(*conn); + for (list<XConfigInfo>::const_iterator it = config_infos.begin(); it != config_infos.end(); ++it) + { + configs.push_back(make_pair(it->config_name, it->subvolume)); + } + } + + return configs; +} + + void command_list_configs(DBus::Connection* conn, Snapper* snapper) { @@ -157,27 +183,14 @@ header.add(_("Subvolume")); table.setHeader(header); - if (no_dbus) - { - list<ConfigInfo> config_infos = Snapper::getConfigs(); - for (list<ConfigInfo>::const_iterator it = config_infos.begin(); it != config_infos.end(); ++it) - { - TableRow row; - row.add(it->getConfigName()); - row.add(it->getSubvolume()); - table.add(row); - } - } - else + list<pair<string, string> > configs = enum_configs(conn); + + for (list<pair<string,string> >::iterator it = configs.begin(); it != configs.end(); ++it) { - list<XConfigInfo> config_infos = command_list_xconfigs(*conn); - for (list<XConfigInfo>::const_iterator it = config_infos.begin(); it != config_infos.end(); ++it) - { - TableRow row; - row.add(it->config_name); - row.add(it->subvolume); - table.add(row); - } + TableRow row; + row.add(it->first); + row.add(it->second); + table.add(row); } cout << table; @@ -381,15 +394,20 @@ << endl << _(" Options for 'list' command:") << endl << _("\t--type, -t <type>\t\tType of snapshots to list.") << endl + << _("\t--all-configs, -a\t\tList snapshots from all accessible configs.") << endl << endl; } +enum ListMode { LM_ALL, LM_SINGLE, LM_PRE_POST }; + +void list_from_one_config(DBus::Connection* conn, Snapper* snapper, string config_name, ListMode list_mode); void command_list(DBus::Connection* conn, Snapper* snapper) { const struct option options[] = { { "type", required_argument, 0, 't' }, + { "all-configs", no_argument, 0, 'a' }, { 0, 0, 0, 0 } }; @@ -400,7 +418,6 @@ exit(EXIT_FAILURE); } - enum ListMode { LM_ALL, LM_SINGLE, LM_PRE_POST }; ListMode list_mode = LM_ALL; GetOpts::parsed_opts::const_iterator opt; @@ -420,6 +437,29 @@ } } + list<pair<string, string> > configs; + if ((opt = opts.find("all-configs")) != opts.end()) + { + configs = enum_configs(conn); + } + else + { + configs.push_back(make_pair(config_name, "")); + } + + for (list<pair<string,string> >::iterator it = configs.begin(); it != configs.end(); ++it) + { + if (it != configs.begin()) + cout << endl; + + if (configs.size() > 1) + cout << "Config: " << it->first << ", subvolume: " << it->second << endl; + list_from_one_config(conn, snapper, it->first, list_mode); + } +} + +void list_from_one_config(DBus::Connection* conn, Snapper* snapper, string config_name, ListMode list_mode) +{ Table table; switch (list_mode) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/snapper-0.2.4/doc/snapper.xml.in new/snapper-0.2.4/doc/snapper.xml.in --- old/snapper-0.2.4/doc/snapper.xml.in 2014-10-02 15:46:25.000000000 +0200 +++ new/snapper-0.2.4/doc/snapper.xml.in 2014-10-06 10:44:19.000000000 +0200 @@ -310,6 +310,12 @@ all, single and pre-post.</para> </listitem> </varlistentry> + <varlistentry> + <term><option>-a, --all-configs</option></term> + <listitem> + <para>List snapshots from all configs accessible by the user.</para> + </listitem> + </varlistentry> </variablelist> </listitem> </varlistentry> -- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
