Hello community,

here is the log from the commit of package snapper for openSUSE:Factory checked 
in at 2014-10-05 20:30:37
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
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-01 
07:40:26.000000000 +0200
+++ /work/SRC/openSUSE:Factory/.snapper.new/snapper.changes     2014-10-05 
20:31:09.000000000 +0200
@@ -1,0 +2,5 @@
+Thu Oct 02 14:46:37 CEST 2014 - aschn...@suse.de
+
+- allow to specify command for comparing file
+
+-------------------------------------------------------------------

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ snapper-0.2.4.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/snapper-0.2.4/client/misc.cc 
new/snapper-0.2.4/client/misc.cc
--- old/snapper-0.2.4/client/misc.cc    2014-08-01 10:12:17.000000000 +0200
+++ new/snapper-0.2.4/client/misc.cc    2014-10-02 15:46:25.000000000 +0200
@@ -27,6 +27,7 @@
 #include <boost/algorithm/string.hpp>
 
 #include <snapper/AppUtil.h>
+#include <snapper/SystemCmd.h>
 
 #include "utils/text.h"
 
@@ -209,3 +210,27 @@
 
     return username;
 }
+
+
+Differ::Differ()
+    : command(DIFFBIN " --new-file --unified"), extensions()
+{
+}
+
+
+void
+Differ::run(const string& f1, const string& f2) const
+{
+    string tmp = command;
+    if (!extensions.empty())
+       tmp += " " + extensions;
+    tmp += " " + quote(f1) + " " + quote(f2);
+
+    SystemCmd cmd(tmp);
+
+    for (const string& line : cmd.stdout())
+       cout << line << endl;
+
+    for (const string& line : cmd.stderr())
+       cerr << line << endl;
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/snapper-0.2.4/client/misc.h 
new/snapper-0.2.4/client/misc.h
--- old/snapper-0.2.4/client/misc.h     2014-08-01 10:12:17.000000000 +0200
+++ new/snapper-0.2.4/client/misc.h     2014-10-02 15:46:25.000000000 +0200
@@ -49,3 +49,14 @@
 
 string
 username(uid_t uid);
+
+
+struct Differ
+{
+    Differ();
+
+    void run(const string& f1, const string& f2) const;
+
+    string command;
+    string extensions;
+};
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-09-12 11:53:52.000000000 +0200
+++ new/snapper-0.2.4/client/snapper.cc 2014-10-02 15:46:25.000000000 +0200
@@ -34,7 +34,6 @@
 #include <snapper/SnapperTmpl.h>
 #include <snapper/Enum.h>
 #include <snapper/AsciiFile.h>
-#include <snapper/SystemCmd.h>
 #include <snapper/SnapperDefines.h>
 #include <snapper/XAttributes.h>
 #ifdef ENABLE_ROLLBACK
@@ -964,6 +963,10 @@
 {
     cout << _("  Comparing snapshots:") << endl
         << _("\tsnapper diff <number1>..<number2> [files]") << endl
+        << endl
+        << _("    Options for 'diff' command:") << endl
+        << _("\t--diff-cmd <command>\t\tCommand used for comparing files.") << 
endl
+        << _("\t--extensions, -x <options>\tExtra options passed to the diff 
command.") << endl
         << endl;
 }
 
@@ -971,15 +974,29 @@
 void
 command_diff(DBus::Connection* conn, Snapper* snapper)
 {
-    GetOpts::parsed_opts opts = getopts.parse("diff", GetOpts::no_options);
+    const struct option options[] = {
+       { "diff-cmd",           required_argument,      0,      0 },
+       { "extensions",         required_argument,      0,      'x' },
+       { 0, 0, 0, 0 }
+    };
+
+    GetOpts::parsed_opts opts = getopts.parse("diff", options);
 
     if (getopts.numArgs() < 1) {
        cerr << _("Command 'diff' needs at least one argument.") << endl;
        exit(EXIT_FAILURE);
     }
 
+    Differ differ;
+
     GetOpts::parsed_opts::const_iterator opt;
 
+    if ((opt = opts.find("diff-cmd")) != opts.end())
+       differ.command = opt->second;
+
+    if ((opt = opts.find("extensions")) != opts.end())
+       differ.extensions = opt->second;
+
     pair<unsigned int, unsigned int> nums(read_nums(getopts.popArg()));
 
     MyComparison comparison(*conn, nums, true);
@@ -988,14 +1005,7 @@
     if (getopts.numArgs() == 0)
     {
        for (Files::const_iterator it1 = files.begin(); it1 != files.end(); 
++it1)
-       {
-           SystemCmd cmd(DIFFBIN " --unified --new-file " + 
quote(it1->getAbsolutePath(LOC_PRE)) +
-                         " " + quote(it1->getAbsolutePath(LOC_POST)), false);
-
-           const vector<string> lines = cmd.stdout();
-           for (vector<string>::const_iterator it2 = lines.begin(); it2 != 
lines.end(); ++it2)
-               cout << it2->c_str() << endl;
-       }
+           differ.run(it1->getAbsolutePath(LOC_PRE), 
it1->getAbsolutePath(LOC_POST));
     }
     else
     {
@@ -1004,15 +1014,8 @@
            string name = getopts.popArg();
 
            Files::const_iterator it1 = files.findAbsolutePath(name);
-            if (it1 == files.end())
-                continue;
-
-           SystemCmd cmd(DIFFBIN " --unified --new-file " + 
quote(it1->getAbsolutePath(LOC_PRE)) +
-                         " " + quote(it1->getAbsolutePath(LOC_POST)), false);
-
-           const vector<string> lines = cmd.stdout();
-           for (vector<string>::const_iterator it2 = lines.begin(); it2 != 
lines.end(); ++it2)
-               cout << it2->c_str() << endl;
+           if (it1 != files.end())
+               differ.run(it1->getAbsolutePath(LOC_PRE), 
it1->getAbsolutePath(LOC_POST));
        }
     }
 }
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-06-02 15:28:35.000000000 
+0200
+++ new/snapper-0.2.4/doc/snapper.xml.in        2014-10-02 15:46:25.000000000 
+0200
@@ -477,6 +477,22 @@
          <replaceable>number2</replaceable>. This will show a diff of the
          content of files and directories that have been created, modified or
          deleted in the time between the two snapshots have been made.</para>
+         <variablelist>
+           <varlistentry>
+             <term><option>--diff-cmd</option> 
<replaceable>command</replaceable></term>
+             <listitem>
+               <para>Command used for comparing files. The default is
+               <filename>/usr/bin/diff --new-file --unified</filename>. The 
two files to
+               compare are passed as parameters to the command.</para>
+             </listitem>
+           </varlistentry>
+           <varlistentry>
+             <term><option>-x, --extensions</option> 
<replaceable>options</replaceable></term>
+             <listitem>
+               <para>Extra options passed to the diff command.</para>
+             </listitem>
+           </varlistentry>
+         </variablelist>
        </listitem>
       </varlistentry>
 

-- 
To unsubscribe, e-mail: opensuse-commit+unsubscr...@opensuse.org
For additional commands, e-mail: opensuse-commit+h...@opensuse.org

Reply via email to