Hello community,

here is the log from the commit of package snapper for openSUSE:Factory
checked in at Fri Aug 12 13:53:38 CEST 2011.



--------
--- snapper/snapper.changes     2011-08-05 14:41:08.000000000 +0200
+++ /mounts/work_src_done/STABLE/snapper/snapper.changes        2011-08-12 
10:58:43.000000000 +0200
@@ -1,0 +2,5 @@
+Thu Aug 11 12:09:19 CEST 2011 - [email protected]
+
+- improvements to command-line interface
+
+-------------------------------------------------------------------

calling whatdependson for head-i586


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

Other differences:
------------------
++++++ snapper.spec ++++++
--- /var/tmp/diff_new_pack.PCpT7x/_old  2011-08-12 13:52:18.000000000 +0200
+++ /var/tmp/diff_new_pack.PCpT7x/_new  2011-08-12 13:52:18.000000000 +0200
@@ -20,7 +20,7 @@
 
 Name:           snapper
 Version:        0.0.7
-Release:        3
+Release:        5
 License:        GPL
 Group:          System/Packages
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build

++++++ snapper-0.0.7.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/snapper-0.0.7/LIBVERSION new/snapper-0.0.7/LIBVERSION
--- old/snapper-0.0.7/LIBVERSION        2011-08-03 14:25:59.000000000 +0200
+++ new/snapper-0.0.7/LIBVERSION        2011-08-11 14:53:42.000000000 +0200
@@ -1 +1 @@
-1.2.0
+1.3.0
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/snapper-0.0.7/doc/snapper.8 
new/snapper-0.0.7/doc/snapper.8
--- old/snapper-0.0.7/doc/snapper.8     2011-08-05 14:40:21.000000000 +0200
+++ new/snapper-0.0.7/doc/snapper.8     2011-08-12 10:58:05.000000000 +0200
@@ -13,7 +13,7 @@
 .SH "DESCRIPTION"
 .LP
 Snapper is a command\-line program for filesystem snapshot management. It can
-create, delete and compare snapshots and rollback changes between
+create, delete and compare snapshots and undo changes between
 snapshots. Supported filesystems are btrfs and ext4.
 
 .SH CONCEPTS
@@ -156,23 +156,26 @@
 Unmount a snapshot. Not required for all filesystem types.
 
 .TP
-.B diff [options] <number1> <number2>
-Compare two snapshots. This will show a list of files and directories
-that have been created, modified or deleted in the time between the two
-snapshots have been made.
+.B diff [options] <number1>..<number2>
+Compare the snapshots number1 and number2. This will show a list of files and
+directories that have been created, modified or deleted in the time between
+the two snapshots have been made.
 .TP
 \fI\-o, \-\-output\fR <file>
 Write output to file <file>.
+
 .TP
-\fI\-f, \-\-file\fR <file>
-Compare the file <file> between the two snapshots.
+.B contentdiff [options] <number1>..<number2> [files]
+Compare the snapshots number1 and number2. 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.
 
 .TP
-.B rollback [options] <number1> <number2>
-Rollback changes between the two snapshots.
+.B undochange [options] <number1>..<number2> [files]
+Undo changes done between snapshot number1 and number2.
 .TP
-\fI\-f, \-\-file\fR <file>
-Read the files to rollback from the file <file>.
+\fI\-i, \-\-input\fR <file>
+Read files for which to undo changes from file <file>.
 
 .TP
 .B cleanup <cleanup-algorithm>
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/snapper-0.0.7/doc/snapper.8.in 
new/snapper-0.0.7/doc/snapper.8.in
--- old/snapper-0.0.7/doc/snapper.8.in  2011-08-05 10:26:24.000000000 +0200
+++ new/snapper-0.0.7/doc/snapper.8.in  2011-08-11 14:53:42.000000000 +0200
@@ -13,7 +13,7 @@
 .SH "DESCRIPTION"
 .LP
 Snapper is a command\-line program for filesystem snapshot management. It can
-create, delete and compare snapshots and rollback changes between
+create, delete and compare snapshots and undo changes between
 snapshots. Supported filesystems are btrfs and ext4.
 
 .SH CONCEPTS
@@ -156,23 +156,26 @@
 Unmount a snapshot. Not required for all filesystem types.
 
 .TP
-.B diff [options] <number1> <number2>
-Compare two snapshots. This will show a list of files and directories
-that have been created, modified or deleted in the time between the two
-snapshots have been made.
+.B diff [options] <number1>..<number2>
+Compare the snapshots number1 and number2. This will show a list of files and
+directories that have been created, modified or deleted in the time between
+the two snapshots have been made.
 .TP
 \fI\-o, \-\-output\fR <file>
 Write output to file <file>.
+
 .TP
-\fI\-f, \-\-file\fR <file>
-Compare the file <file> between the two snapshots.
+.B contentdiff [options] <number1>..<number2> [files]
+Compare the snapshots number1 and number2. 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.
 
 .TP
-.B rollback [options] <number1> <number2>
-Rollback changes between the two snapshots.
+.B undochange [options] <number1>..<number2> [files]
+Undo changes done between snapshot number1 and number2.
 .TP
-\fI\-f, \-\-file\fR <file>
-Read the files to rollback from the file <file>.
+\fI\-i, \-\-input\fR <file>
+Read files for which to undo changes from file <file>.
 
 .TP
 .B cleanup <cleanup-algorithm>
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/snapper-0.0.7/snapper/AppUtil.cc 
new/snapper-0.0.7/snapper/AppUtil.cc
--- old/snapper-0.0.7/snapper/AppUtil.cc        2011-08-04 17:59:55.000000000 
+0200
+++ new/snapper-0.0.7/snapper/AppUtil.cc        2011-08-08 11:38:25.000000000 
+0200
@@ -174,7 +174,7 @@
     switch (level)
     {
        case DEBUG:
-           return curLevel >= ::blocxx::E_DEBUG_LEVEL;
+           return false; // curLevel >= ::blocxx::E_DEBUG_LEVEL;
        case MILESTONE:
            return curLevel >= ::blocxx::E_INFO_LEVEL;
        case WARNING:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/snapper-0.0.7/snapper/Comparison.cc 
new/snapper-0.0.7/snapper/Comparison.cc
--- old/snapper-0.0.7/snapper/Comparison.cc     2011-04-21 09:00:40.000000000 
+0200
+++ new/snapper-0.0.7/snapper/Comparison.cc     2011-08-11 15:50:15.000000000 
+0200
@@ -45,17 +45,17 @@
     }
 
 
-    RollbackStatistic
-    Comparison::getRollbackStatistic() const
+    UndoStatistic
+    Comparison::getUndoStatistic() const
     {
-       return files.getRollbackStatistic();
+       return files.getUndoStatistic();
     }
 
 
     bool
-    Comparison::doRollback()
+    Comparison::doUndo()
     {
-       return files.doRollback();
+       return files.doUndo();
     }
 
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/snapper-0.0.7/snapper/Comparison.h 
new/snapper-0.0.7/snapper/Comparison.h
--- old/snapper-0.0.7/snapper/Comparison.h      2011-03-04 12:23:18.000000000 
+0100
+++ new/snapper-0.0.7/snapper/Comparison.h      2011-08-11 14:53:42.000000000 
+0200
@@ -47,9 +47,9 @@
        Files& getFiles() { return files; }
        const Files& getFiles() const { return files; }
 
-       RollbackStatistic getRollbackStatistic() const;
+       UndoStatistic getUndoStatistic() const;
 
-       bool doRollback();
+       bool doUndo();
 
     private:
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/snapper-0.0.7/snapper/File.cc 
new/snapper-0.0.7/snapper/File.cc
--- old/snapper-0.0.7/snapper/File.cc   2011-08-03 14:55:29.000000000 +0200
+++ new/snapper-0.0.7/snapper/File.cc   2011-08-11 15:50:15.000000000 +0200
@@ -45,7 +45,7 @@
 namespace snapper
 {
 
-    std::ostream& operator<<(std::ostream& s, const RollbackStatistic& rs)
+    std::ostream& operator<<(std::ostream& s, const UndoStatistic& rs)
     {
        s << "numCreate:" << rs.numCreate
          << " numModify:" << rs.numModify
@@ -55,14 +55,14 @@
     }
 
 
-    RollbackStatistic::RollbackStatistic()
+    UndoStatistic::UndoStatistic()
        : numCreate(0), numModify(0), numDelete(0)
     {
     }
 
 
     bool
-    RollbackStatistic::empty() const
+    UndoStatistic::empty() const
     {
        return numCreate == 0 && numModify == 0 && numDelete == 0;
     }
@@ -300,7 +300,7 @@
     Files::find(const string& name)
     {
        iterator ret = lower_bound(entries.begin(), entries.end(), name, 
file_name_less);
-       return ret->getName() == name ? ret : end();
+       return (ret != end() && ret->getName() == name) ? ret : end();
     }
 
 
@@ -308,7 +308,7 @@
     Files::find(const string& name) const
     {
        const_iterator ret = lower_bound(entries.begin(), entries.end(), name, 
file_name_less);
-       return ret->getName() == name ? ret : end();
+       return (ret != end() && ret->getName() == name) ? ret : end();
     }
 
 
@@ -641,15 +641,18 @@
 
 
     bool
-    File::doRollback()
+    File::doUndo()
     {
-       if (getSnapper()->getRollbackCallback())
+       if (comparison->getSnapshot1()->isCurrent())
+           throw IllegalSnapshotException();
+
+       if (getSnapper()->getUndoCallback())
        {
            switch (getAction())
            {
-               case CREATE: 
getSnapper()->getRollbackCallback()->createInfo(name); break;
-               case MODIFY: 
getSnapper()->getRollbackCallback()->modifyInfo(name); break;
-               case DELETE: 
getSnapper()->getRollbackCallback()->deleteInfo(name); break;
+               case CREATE: getSnapper()->getUndoCallback()->createInfo(name); 
break;
+               case MODIFY: getSnapper()->getUndoCallback()->modifyInfo(name); 
break;
+               case DELETE: getSnapper()->getUndoCallback()->deleteInfo(name); 
break;
            }
        }
 
@@ -673,13 +676,13 @@
                error = true;
        }
 
-       if (error && getSnapper()->getRollbackCallback())
+       if (error && getSnapper()->getUndoCallback())
        {
            switch (getAction())
            {
-               case CREATE: 
getSnapper()->getRollbackCallback()->createError(name); break;
-               case MODIFY: 
getSnapper()->getRollbackCallback()->modifyError(name); break;
-               case DELETE: 
getSnapper()->getRollbackCallback()->deleteError(name); break;
+               case CREATE: 
getSnapper()->getUndoCallback()->createError(name); break;
+               case MODIFY: 
getSnapper()->getUndoCallback()->modifyError(name); break;
+               case DELETE: 
getSnapper()->getUndoCallback()->deleteError(name); break;
            }
        }
 
@@ -698,14 +701,17 @@
     }
 
 
-    RollbackStatistic
-    Files::getRollbackStatistic() const
+    UndoStatistic
+    Files::getUndoStatistic() const
     {
-       RollbackStatistic rs;
+       if (comparison->getSnapshot1()->isCurrent())
+           throw IllegalSnapshotException();
+
+       UndoStatistic rs;
 
        for (vector<File>::const_iterator it = entries.begin(); it != 
entries.end(); ++it)
        {
-           if (it->getRollback())
+           if (it->getUndo())
            {
                switch (it->getAction())
                {
@@ -721,39 +727,42 @@
 
 
     bool
-    Files::doRollback()
+    Files::doUndo()
     {
-       y2mil("begin rollback");
+       if (comparison->getSnapshot1()->isCurrent())
+           throw IllegalSnapshotException();
+
+       y2mil("begin doUndo");
 
-       if (getSnapper()->getRollbackCallback())
-           getSnapper()->getRollbackCallback()->start();
+       if (getSnapper()->getUndoCallback())
+           getSnapper()->getUndoCallback()->start();
 
        for (vector<File>::reverse_iterator it = entries.rbegin(); it != 
entries.rend(); ++it)
        {
-           if (it->getRollback())
+           if (it->getUndo())
            {
                if (it->getPreToPostStatus() == CREATED)
                {
-                   it->doRollback();
+                   it->doUndo();
                }
            }
        }
 
        for (vector<File>::iterator it = entries.begin(); it != entries.end(); 
++it)
        {
-           if (it->getRollback())
+           if (it->getUndo())
            {
                if (it->getPreToPostStatus() != CREATED)
                {
-                   it->doRollback();
+                   it->doUndo();
                }
            }
        }
 
-       if (getSnapper()->getRollbackCallback())
-           getSnapper()->getRollbackCallback()->stop();
+       if (getSnapper()->getUndoCallback())
+           getSnapper()->getUndoCallback()->stop();
 
-       y2mil("end rollback");
+       y2mil("end doUndo");
 
        return true;
     }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/snapper-0.0.7/snapper/File.h 
new/snapper-0.0.7/snapper/File.h
--- old/snapper-0.0.7/snapper/File.h    2011-08-03 14:25:59.000000000 +0200
+++ new/snapper-0.0.7/snapper/File.h    2011-08-11 14:53:42.000000000 +0200
@@ -57,9 +57,9 @@
     };
 
 
-    struct RollbackStatistic
+    struct UndoStatistic
     {
-       RollbackStatistic();
+       UndoStatistic();
 
        bool empty() const;
 
@@ -67,7 +67,7 @@
        unsigned int numModify;
        unsigned int numDelete;
 
-       friend std::ostream& operator<<(std::ostream& s, const 
RollbackStatistic& rs);
+       friend std::ostream& operator<<(std::ostream& s, const UndoStatistic& 
rs);
     };
 
 
@@ -78,7 +78,7 @@
        File(const Comparison* comparison, const string& name,
             unsigned int pre_to_post_status)
            : comparison(comparison), name(name), 
pre_to_post_status(pre_to_post_status),
-             pre_to_system_status(-1), post_to_system_status(-1), 
rollback(false)
+             pre_to_system_status(-1), post_to_system_status(-1), undo(false)
        {}
 
        const string& getName() const { return name; }
@@ -93,10 +93,12 @@
 
        vector<string> getDiff(const string& options) const;
 
-       bool getRollback() const { return rollback; }
-       void setRollback(bool value) { rollback = value; }
+       bool getUndo() const { return undo; }
+       void setUndo(bool value) { undo = value; }
+       bool doUndo();
 
-       bool doRollback();
+       void setRollback(bool value) __attribute__ ((deprecated)) { 
setUndo(value); }
+       bool doRollback() __attribute__ ((deprecated)) { return doUndo(); }
 
        enum Action { CREATE, MODIFY, DELETE };
 
@@ -127,7 +129,7 @@
        unsigned int pre_to_system_status; // -1 if invalid
        unsigned int post_to_system_status; // -1 if invalid
 
-       bool rollback;
+       bool undo;
 
     };
 
@@ -175,9 +177,9 @@
        bool save();
        void filter();
 
-       RollbackStatistic getRollbackStatistic() const;
+       UndoStatistic getUndoStatistic() const;
 
-       bool doRollback();
+       bool doUndo();
 
        const Comparison* comparison;
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/snapper-0.0.7/snapper/Snapper.cc 
new/snapper-0.0.7/snapper/Snapper.cc
--- old/snapper-0.0.7/snapper/Snapper.cc        2011-08-05 11:21:57.000000000 
+0200
+++ new/snapper-0.0.7/snapper/Snapper.cc        2011-08-11 14:53:42.000000000 
+0200
@@ -48,7 +48,7 @@
 
     Snapper::Snapper(const string& config_name, bool disable_filters)
        : config_name(config_name), config(NULL), subvolume("/"), 
filesystem(NULL),
-         snapshots(this), compare_callback(NULL), rollback_callback(NULL)
+         snapshots(this), compare_callback(NULL), undo_callback(NULL)
     {
        y2mil("Snapper constructor");
        y2mil("libsnapper version " VERSION);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/snapper-0.0.7/snapper/Snapper.h 
new/snapper-0.0.7/snapper/Snapper.h
--- old/snapper-0.0.7/snapper/Snapper.h 2011-08-02 12:19:16.000000000 +0200
+++ new/snapper-0.0.7/snapper/Snapper.h 2011-08-11 14:53:42.000000000 +0200
@@ -48,10 +48,10 @@
     };
 
 
-    struct RollbackCallback
+    struct UndoCallback
     {
-       RollbackCallback() {}
-       virtual ~RollbackCallback() {}
+       UndoCallback() {}
+       virtual ~UndoCallback() {}
 
        virtual void start() = 0;
        virtual void stop() = 0;
@@ -133,8 +133,8 @@
        void setCompareCallback(CompareCallback* p) { compare_callback = p; }
        CompareCallback* getCompareCallback() const { return compare_callback; }
 
-       void setRollbackCallback(RollbackCallback* p) { rollback_callback = p; }
-       RollbackCallback* getRollbackCallback() const { return 
rollback_callback; }
+       void setUndoCallback(UndoCallback* p) { undo_callback = p; }
+       UndoCallback* getUndoCallback() const { return undo_callback; }
 
        const vector<string>& getIgnorePatterns() const { return 
ignore_patterns; }
 
@@ -166,7 +166,7 @@
        Snapshots snapshots;
 
        CompareCallback* compare_callback;
-       RollbackCallback* rollback_callback;
+       UndoCallback* undo_callback;
 
     };
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/snapper-0.0.7/testsuite-real/common.cc 
new/snapper-0.0.7/testsuite-real/common.cc
--- old/snapper-0.0.7/testsuite-real/common.cc  2011-07-29 16:34:02.000000000 
+0200
+++ new/snapper-0.0.7/testsuite-real/common.cc  2011-08-11 14:53:42.000000000 
+0200
@@ -40,10 +40,10 @@
 CompareCallbackImpl compare_callback_impl;
 
 
-struct RollbackCallbackImpl : public RollbackCallback
+struct UndoCallbackImpl : public UndoCallback
 {
-    void start() { cout << "running rollback..." << endl; }
-    void stop() { cout << "rollback done" << endl; }
+    void start() { cout << "undoing..." << endl; }
+    void stop() { cout << "undoing done" << endl; }
 
     void createInfo(const string& name) { cout << "creating " << name << endl; 
}
     void modifyInfo(const string& name) { cout << "modifying " << name << 
endl; }
@@ -54,7 +54,7 @@
     void deleteError(const string& name) { cout << "failed to delete " << name 
<< endl; numDeleteErrors++; }
 };
 
-RollbackCallbackImpl rollback_callback_impl;
+UndoCallbackImpl undo_callback_impl;
 
 
 void
@@ -68,7 +68,7 @@
     sh = createSnapper("testsuite");
 
     sh->setCompareCallback(&compare_callback_impl);
-    sh->setRollbackCallback(&rollback_callback_impl);
+    sh->setUndoCallback(&undo_callback_impl);
 }
 
 
@@ -89,15 +89,15 @@
 
 
 void
-check_rollback_statistics(unsigned int numCreate, unsigned int numModify, 
unsigned int numDelete)
+check_undo_statistics(unsigned int numCreate, unsigned int numModify, unsigned 
int numDelete)
 {
     Comparison comparison(sh, first, second);
 
     Files& files = comparison.getFiles();
     for (Files::iterator it = files.begin(); it != files.end(); ++it)
-       it->setRollback(true);
+       it->setUndo(true);
 
-    RollbackStatistic rs = comparison.getRollbackStatistic();
+    UndoStatistic rs = comparison.getUndoStatistic();
 
     check_equal(rs.numCreate, numCreate);
     check_equal(rs.numModify, numModify);
@@ -106,7 +106,7 @@
 
 
 void
-rollback()
+undo()
 {
     numCreateErrors = numModifyErrors = numDeleteErrors = 0;
 
@@ -114,14 +114,14 @@
 
     Files& files = comparison.getFiles();
     for (Files::iterator it = files.begin(); it != files.end(); ++it)
-       it->setRollback(true);
+       it->setUndo(true);
 
-    comparison.doRollback();
+    comparison.doUndo();
 }
 
 
 void
-check_rollback_errors(unsigned int numCreate, unsigned int numModify, unsigned 
int numDelete)
+check_undo_errors(unsigned int numCreate, unsigned int numModify, unsigned int 
numDelete)
 {
     check_equal(numCreateErrors, numCreate);
     check_equal(numModifyErrors, numModify);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/snapper-0.0.7/testsuite-real/common.h 
new/snapper-0.0.7/testsuite-real/common.h
--- old/snapper-0.0.7/testsuite-real/common.h   2011-05-03 15:19:07.000000000 
+0200
+++ new/snapper-0.0.7/testsuite-real/common.h   2011-08-11 14:53:42.000000000 
+0200
@@ -46,11 +46,11 @@
 void setup();
 void first_snapshot();
 void second_snapshot();
-void check_rollback_statistics(unsigned int numCreate, unsigned int numModify,
-                              unsigned int numDelete);
-void rollback();
-void check_rollback_errors(unsigned int numCreate, unsigned int numModify,
+void check_undo_statistics(unsigned int numCreate, unsigned int numModify,
                           unsigned int numDelete);
+void undo();
+void check_undo_errors(unsigned int numCreate, unsigned int numModify,
+                      unsigned int numDelete);
 void check_first();
 
 void run_command(const char* command);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/snapper-0.0.7/testsuite-real/directory1.cc 
new/snapper-0.0.7/testsuite-real/directory1.cc
--- old/snapper-0.0.7/testsuite-real/directory1.cc      2011-05-23 
10:06:20.000000000 +0200
+++ new/snapper-0.0.7/testsuite-real/directory1.cc      2011-08-11 
14:53:42.000000000 +0200
@@ -22,11 +22,11 @@
 
     run_command("mkdir already-here");
 
-    check_rollback_statistics(1, 0, 0);
+    check_undo_statistics(1, 0, 0);
 
-    rollback();
+    undo();
 
-    check_rollback_errors(0, 0, 0);
+    check_undo_errors(0, 0, 0);
 
     check_first();
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/snapper-0.0.7/testsuite-real/error1.cc 
new/snapper-0.0.7/testsuite-real/error1.cc
--- old/snapper-0.0.7/testsuite-real/error1.cc  2011-05-03 15:19:07.000000000 
+0200
+++ new/snapper-0.0.7/testsuite-real/error1.cc  2011-08-11 14:53:42.000000000 
+0200
@@ -20,11 +20,11 @@
 
     run_command("touch not-empty/bad");
 
-    check_rollback_statistics(0, 0, 1);
+    check_undo_statistics(0, 0, 1);
 
-    rollback();
+    undo();
 
-    check_rollback_errors(0, 0, 1);
+    check_undo_errors(0, 0, 1);
 
     exit(EXIT_SUCCESS);
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/snapper-0.0.7/testsuite-real/error2.cc 
new/snapper-0.0.7/testsuite-real/error2.cc
--- old/snapper-0.0.7/testsuite-real/error2.cc  2011-05-12 10:42:14.000000000 
+0200
+++ new/snapper-0.0.7/testsuite-real/error2.cc  2011-08-11 14:53:42.000000000 
+0200
@@ -23,11 +23,11 @@
 
     run_command("rm not-here");
 
-    check_rollback_statistics(0, 1, 0);
+    check_undo_statistics(0, 1, 0);
 
-    rollback();
+    undo();
 
-    check_rollback_errors(0, 1, 0);
+    check_undo_errors(0, 1, 0);
 
     exit(EXIT_SUCCESS);
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/snapper-0.0.7/testsuite-real/error4.cc 
new/snapper-0.0.7/testsuite-real/error4.cc
--- old/snapper-0.0.7/testsuite-real/error4.cc  2011-05-20 12:32:14.000000000 
+0200
+++ new/snapper-0.0.7/testsuite-real/error4.cc  2011-08-11 14:53:42.000000000 
+0200
@@ -24,11 +24,11 @@
     run_command("rmdir wrong-type");
     run_command("touch wrong-type");
 
-    check_rollback_statistics(1, 0, 0);
+    check_undo_statistics(1, 0, 0);
 
-    rollback();
+    undo();
 
-    check_rollback_errors(1, 0, 0);
+    check_undo_errors(1, 0, 0);
 
     exit(EXIT_SUCCESS);
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/snapper-0.0.7/testsuite-real/missing-directory1.cc 
new/snapper-0.0.7/testsuite-real/missing-directory1.cc
--- old/snapper-0.0.7/testsuite-real/missing-directory1.cc      2011-05-20 
12:32:14.000000000 +0200
+++ new/snapper-0.0.7/testsuite-real/missing-directory1.cc      2011-08-11 
14:53:42.000000000 +0200
@@ -25,11 +25,11 @@
 
     run_command("rmdir not-here");
 
-    check_rollback_statistics(2, 0, 0);
+    check_undo_statistics(2, 0, 0);
 
-    rollback();
+    undo();
 
-    check_rollback_errors(0, 0, 0);
+    check_undo_errors(0, 0, 0);
 
     check_first();
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/snapper-0.0.7/testsuite-real/owner1.cc 
new/snapper-0.0.7/testsuite-real/owner1.cc
--- old/snapper-0.0.7/testsuite-real/owner1.cc  2011-05-03 15:19:07.000000000 
+0200
+++ new/snapper-0.0.7/testsuite-real/owner1.cc  2011-08-11 14:53:42.000000000 
+0200
@@ -29,11 +29,11 @@
 
     second_snapshot();
 
-    check_rollback_statistics(3, 0, 0);
+    check_undo_statistics(3, 0, 0);
 
-    rollback();
+    undo();
 
-    check_rollback_errors(0, 0, 0);
+    check_undo_errors(0, 0, 0);
 
     check_first();
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/snapper-0.0.7/testsuite-real/owner2.cc 
new/snapper-0.0.7/testsuite-real/owner2.cc
--- old/snapper-0.0.7/testsuite-real/owner2.cc  2011-05-03 15:19:07.000000000 
+0200
+++ new/snapper-0.0.7/testsuite-real/owner2.cc  2011-08-11 14:53:42.000000000 
+0200
@@ -24,11 +24,11 @@
 
     second_snapshot();
 
-    check_rollback_statistics(0, 3, 0);
+    check_undo_statistics(0, 3, 0);
 
-    rollback();
+    undo();
 
-    check_rollback_errors(0, 0, 0);
+    check_undo_errors(0, 0, 0);
 
     check_first();
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/snapper-0.0.7/testsuite-real/owner3.cc 
new/snapper-0.0.7/testsuite-real/owner3.cc
--- old/snapper-0.0.7/testsuite-real/owner3.cc  2011-05-20 15:20:53.000000000 
+0200
+++ new/snapper-0.0.7/testsuite-real/owner3.cc  2011-08-11 14:53:42.000000000 
+0200
@@ -23,11 +23,11 @@
 
     second_snapshot();
 
-    check_rollback_statistics(0, 1, 0);
+    check_undo_statistics(0, 1, 0);
 
-    rollback();
+    undo();
 
-    check_rollback_errors(0, 0, 0);
+    check_undo_errors(0, 0, 0);
 
     check_first();
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/snapper-0.0.7/testsuite-real/permissions1.cc 
new/snapper-0.0.7/testsuite-real/permissions1.cc
--- old/snapper-0.0.7/testsuite-real/permissions1.cc    2011-05-03 
15:19:07.000000000 +0200
+++ new/snapper-0.0.7/testsuite-real/permissions1.cc    2011-08-11 
14:53:42.000000000 +0200
@@ -30,11 +30,11 @@
 
     second_snapshot();
 
-    check_rollback_statistics(4, 0, 0);
+    check_undo_statistics(4, 0, 0);
 
-    rollback();
+    undo();
 
-    check_rollback_errors(0, 0, 0);
+    check_undo_errors(0, 0, 0);
 
     check_first();
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/snapper-0.0.7/testsuite-real/permissions2.cc 
new/snapper-0.0.7/testsuite-real/permissions2.cc
--- old/snapper-0.0.7/testsuite-real/permissions2.cc    2011-05-03 
15:19:07.000000000 +0200
+++ new/snapper-0.0.7/testsuite-real/permissions2.cc    2011-08-11 
14:53:42.000000000 +0200
@@ -24,11 +24,11 @@
 
     second_snapshot();
 
-    check_rollback_statistics(0, 2, 0);
+    check_undo_statistics(0, 2, 0);
 
-    rollback();
+    undo();
 
-    check_rollback_errors(0, 0, 0);
+    check_undo_errors(0, 0, 0);
 
     check_first();
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/snapper-0.0.7/testsuite-real/simple1.cc 
new/snapper-0.0.7/testsuite-real/simple1.cc
--- old/snapper-0.0.7/testsuite-real/simple1.cc 2011-05-03 15:19:07.000000000 
+0200
+++ new/snapper-0.0.7/testsuite-real/simple1.cc 2011-08-11 14:53:42.000000000 
+0200
@@ -28,11 +28,11 @@
 
     second_snapshot();
 
-    check_rollback_statistics(3, 0, 3);
+    check_undo_statistics(3, 0, 3);
 
-    rollback();
+    undo();
 
-    check_rollback_errors(0, 0, 0);
+    check_undo_errors(0, 0, 0);
 
     check_first();
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/snapper-0.0.7/tools/snapper.cc 
new/snapper-0.0.7/tools/snapper.cc
--- old/snapper-0.0.7/tools/snapper.cc  2011-08-04 21:12:47.000000000 +0200
+++ new/snapper-0.0.7/tools/snapper.cc  2011-08-11 15:50:15.000000000 +0200
@@ -173,9 +173,15 @@
 {
     Snapshots& snapshots = sh->getSnapshots();
 
+    istringstream s(str);
     unsigned int num = 0;
-    if (str != "current")
-       str >> num;
+    s >> num;
+
+    if (s.fail() || !s.eof())
+    {
+       cerr << sformat(_("Invalid snapshot '%s'."), str.c_str()) << endl;
+       exit(EXIT_FAILURE);
+    }
 
     Snapshots::iterator snap = snapshots.find(num);
     if (snap == snapshots.end())
@@ -188,6 +194,29 @@
 }
 
 
+pair<Snapshots::iterator, Snapshots::iterator>
+readNums(const string& str)
+{
+    string::size_type pos = str.find("..");
+    if (pos == string::npos)
+    {
+       cerr << _("Invalid snapshots.") << endl;
+       exit(EXIT_FAILURE);
+    }
+
+    Snapshots::iterator snap1 = readNum(str.substr(0, pos));
+    Snapshots::iterator snap2 = readNum(str.substr(pos + 2));
+
+    if (snap1 == snap2)
+    {
+       cerr << _("Identical snapshots.") << endl;
+       exit(EXIT_FAILURE);
+    }
+
+    return pair<Snapshots::iterator, Snapshots::iterator>(snap1, snap2);
+}
+
+
 void
 help_list()
 {
@@ -311,8 +340,8 @@
                TableRow row;
                row.add(decString(it1->getNum()));
                row.add(decString(it2->getNum()));
-               row.add(it1->isCurrent() ? "" : datetime(it1->getDate(), false, 
false));
-               row.add(it2->isCurrent() ? "" : datetime(it2->getDate(), false, 
false));
+               row.add(datetime(it1->getDate(), false, false));
+               row.add(datetime(it2->getDate(), false, false));
                row.add(it1->getDescription());
                table.add(row);
            }
@@ -359,8 +388,10 @@
        exit(EXIT_FAILURE);
     }
 
+    const Snapshots& snapshots = sh->getSnapshots();
+
     SnapshotType type = SINGLE;
-    Snapshots::const_iterator snap1;
+    Snapshots::const_iterator snap1 = snapshots.end();
     string description;
     bool print_number = false;
     string cleanup;
@@ -388,6 +419,12 @@
     if ((opt = opts.find("cleanup-algorithm")) != opts.end())
        cleanup = opt->second;
 
+    if (type == POST && (snap1 == snapshots.end() || snap1->isCurrent()))
+    {
+       cerr << _("Missing or invalid pre-number.") << endl;
+       exit(EXIT_FAILURE);
+    }
+
     switch (type)
     {
        case SINGLE: {
@@ -443,6 +480,11 @@
     }
 
     Snapshots::iterator snapshot = readNum(getopts.popArg());
+    if (snapshot->isCurrent())
+    {
+       cerr << _("Invalid snapshot.") << endl;
+       exit(EXIT_FAILURE);
+    }
 
     GetOpts::parsed_opts::const_iterator opt;
 
@@ -473,6 +515,12 @@
     while (getopts.hasArgs())
     {
        Snapshots::iterator snapshot = readNum(getopts.popArg());
+       if (snapshot->isCurrent())
+       {
+           cerr << _("Invalid snapshot.") << endl;
+           exit(EXIT_FAILURE);
+       }
+
        sh->deleteSnapshot(snapshot);
     }
 }
@@ -500,6 +548,12 @@
     while (getopts.hasArgs())
     {
        Snapshots::iterator snapshot = readNum(getopts.popArg());
+       if (snapshot->isCurrent())
+       {
+           cerr << _("Invalid snapshot.") << endl;
+           exit(EXIT_FAILURE);
+       }
+
        snapshot->mountFilesystemSnapshot();
     }
 }
@@ -527,6 +581,12 @@
     while (getopts.hasArgs())
     {
        Snapshots::iterator snapshot = readNum(getopts.popArg());
+       if (snapshot->isCurrent())
+       {
+           cerr << _("Invalid snapshot.") << endl;
+           exit(EXIT_FAILURE);
+       }
+
        snapshot->umountFilesystemSnapshot();
     }
 }
@@ -536,11 +596,10 @@
 help_diff()
 {
     cout << _("  Comparing snapshots:") << endl
-        << _("\tsnapper diff <number1> <number2>") << endl
+        << _("\tsnapper diff <number1>..<number2>") << endl
         << endl
         << _("    Options for 'diff' command:") << endl
         << _("\t--output, -o <file>\t\tSave diff to file.") << endl
-        << _("\t--file, -f <file>\t\tRun diff for file.") << endl
         << endl;
 }
 
@@ -550,38 +609,24 @@
 {
     const struct option options[] = {
        { "output",             required_argument,      0,      'o' },
-       { "file",               required_argument,      0,      'f' },
        { 0, 0, 0, 0 }
     };
 
     GetOpts::parsed_opts opts = getopts.parse("diff", options);
-    if (getopts.numArgs() != 2)
+    if (getopts.numArgs() != 1)
     {
-       cerr << _("Command 'diff' needs two arguments.") << endl;
+       cerr << _("Command 'diff' needs one argument.") << endl;
        exit(EXIT_FAILURE);
     }
 
     GetOpts::parsed_opts::const_iterator opt;
 
-    Snapshots::const_iterator snap1 = readNum(getopts.popArg());
-    Snapshots::const_iterator snap2 = readNum(getopts.popArg());
+    pair<Snapshots::const_iterator, Snapshots::const_iterator> 
snaps(readNums(getopts.popArg()));
 
-    Comparison comparison(sh, snap1, snap2);
+    Comparison comparison(sh, snaps.first, snaps.second);
 
     const Files& files = comparison.getFiles();
 
-    Files::const_iterator tmp = files.end();
-
-    if ((opt = opts.find("file")) != opts.end())
-    {
-       tmp = files.findAbsolutePath(opt->second);
-       if (tmp == files.end())
-       {
-           cerr << sformat(_("File '%s' not included in diff."), 
opt->second.c_str()) << endl;
-           exit(EXIT_FAILURE);
-       }
-    }
-
     FILE* file = stdout;
 
     if ((opt = opts.find("output")) != opts.end())
@@ -594,59 +639,98 @@
        }
     }
 
-    if (tmp == files.end())
+    for (Files::const_iterator it = files.begin(); it != files.end(); ++it)
+       fprintf(file, "%s %s\n", 
statusToString(it->getPreToPostStatus()).c_str(),
+               it->getAbsolutePath(LOC_SYSTEM).c_str());
+
+    if (file != stdout)
+       fclose(file);
+}
+
+
+void
+help_contentdiff()
+{
+    cout << _("  Comparing snapshots:") << endl
+        << _("\tsnapper contentdiff <number1>..<number2> [files]") << endl
+        << endl;
+}
+
+
+void
+command_contentdiff()
+{
+    GetOpts::parsed_opts opts = getopts.parse("contentdiff", 
GetOpts::no_options);
+
+    GetOpts::parsed_opts::const_iterator opt;
+
+    pair<Snapshots::const_iterator, Snapshots::const_iterator> 
snaps(readNums(getopts.popArg()));
+
+    Comparison comparison(sh, snaps.first, snaps.second);
+
+    const Files& files = comparison.getFiles();
+
+    if (getopts.numArgs() == 0)
     {
-       for (Files::const_iterator it = files.begin(); it != files.end(); ++it)
-           fprintf(file, "%s %s\n", 
statusToString(it->getPreToPostStatus()).c_str(),
-                   it->getAbsolutePath(LOC_SYSTEM).c_str());
+       for (Files::const_iterator it1 = files.begin(); it1 != files.end(); 
++it1)
+       {
+           vector<string> lines = it1->getDiff("--unified --new-file");
+           for (vector<string>::const_iterator it2 = lines.begin(); it2 != 
lines.end(); ++it2)
+               cout << it2->c_str() << endl;
+       }
     }
     else
     {
-       vector<string> lines = tmp->getDiff("--unified --new-file");
-       for (vector<string>::const_iterator it = lines.begin(); it != 
lines.end(); ++it)
-           fprintf(file, "%s\n", it->c_str());
-    }
+       while (getopts.numArgs() > 0)
+       {
+           string name = getopts.popArg();
 
-    if (file != stdout)
-       fclose(file);
+           Files::const_iterator tmp = files.findAbsolutePath(name);
+           if (tmp == files.end())
+               continue;
+
+           vector<string> lines = tmp->getDiff("--unified --new-file");
+           for (vector<string>::const_iterator it2 = lines.begin(); it2 != 
lines.end(); ++it2)
+               cout << it2->c_str() << endl;
+       }
+    }
 }
 
 
 void
-help_rollback()
+help_undo()
 {
-    cout << _("  Rollback snapshots:") << endl
-        << _("\tsnapper rollback <number1> <number2>") << endl
+    cout << _("  Undo changes:") << endl
+        << _("\tsnapper undochange <number1>..<number2> [files]") << endl
         << endl
-        << _("    Options for 'rollback' command:") << endl
-        << _("\t--file, -f <file>\t\tRead files to rollback from file.") << 
endl
+        << _("    Options for 'undochange' command:") << endl
+        << _("\t--input, -i <file>\t\tRead files for which to undo changes 
from file.") << endl
         << endl;
 }
 
 
 void
-command_rollback()
+command_undo()
 {
     const struct option options[] = {
-       { "file",               required_argument,      0,      'f' },
+       { "input",              required_argument,      0,      'i' },
        { 0, 0, 0, 0 }
     };
 
-    GetOpts::parsed_opts opts = getopts.parse("rollback", options);
-    if (getopts.numArgs() != 2)
+    GetOpts::parsed_opts opts = getopts.parse("undochange", options);
+    if (getopts.numArgs() < 1)
     {
-       cerr << _("Command 'rollback' needs two arguments.") << endl;
+       cerr << _("Command 'undochange' needs at least one argument.") << endl;
        exit(EXIT_FAILURE);
     }
 
-    Snapshots::const_iterator snap1 = readNum(getopts.popArg());
-    Snapshots::const_iterator snap2 = readNum(getopts.popArg());
+    pair<Snapshots::const_iterator, Snapshots::const_iterator> 
snaps(readNums(getopts.popArg()));
 
     FILE* file = NULL;
 
     GetOpts::parsed_opts::const_iterator opt;
 
-    if ((opt = opts.find("file")) != opts.end())
+    if ((opt = opts.find("input")) != opts.end())
     {
        file = fopen(opt->second.c_str(), "r");
        if (!file)
@@ -656,7 +740,13 @@
        }
     }
 
-    Comparison comparison(sh, snap1, snap2);
+    if (snaps.first->isCurrent())
+    {
+       cerr << _("Invalid snapshots.") << endl;
+       exit(EXIT_FAILURE);
+    }
+
+    Comparison comparison(sh, snaps.first, snaps.second);
 
     Files& files = comparison.getFiles();
 
@@ -689,16 +779,32 @@
                exit(EXIT_FAILURE);
            }
 
-           it->setRollback(true);
+           it->setUndo(true);
        }
     }
     else
     {
-       for (Files::iterator it = files.begin(); it != files.end(); ++it)
-           it->setRollback(true);
+       if (getopts.numArgs() == 0)
+       {
+           for (Files::iterator it = files.begin(); it != files.end(); ++it)
+               it->setUndo(true);
+       }
+       else
+       {
+           while (getopts.numArgs() > 0)
+           {
+               string name = getopts.popArg();
+
+               Files::iterator tmp = files.findAbsolutePath(name);
+               if (tmp == files.end())
+                   continue;
+
+               tmp->setUndo(true);
+           }
+       }
     }
 
-    RollbackStatistic rs = comparison.getRollbackStatistic();
+    UndoStatistic rs = comparison.getUndoStatistic();
 
     if (rs.empty())
     {
@@ -709,7 +815,7 @@
     cout << "create:" << rs.numCreate << " modify:" << rs.numModify << " 
delete:" << rs.numDelete
         << endl;
 
-    comparison.doRollback();
+    comparison.doUndo();
 }
 
 
@@ -789,7 +895,8 @@
     help_mount();
     help_umount();
     help_diff();
-    help_rollback();
+    help_contentdiff();
+    help_undo();
     help_cleanup();
 }
 
@@ -803,10 +910,10 @@
 CompareCallbackImpl compare_callback_impl;
 
 
-struct RollbackCallbackImpl : public RollbackCallback
+struct UndoCallbackImpl : public UndoCallback
 {
-    void start() { cout << _("running rollback...") << endl; }
-    void stop() { cout << _("rollback done") << endl; }
+    void start() { cout << _("undoing change...") << endl; }
+    void stop() { cout << _("undoing change done") << endl; }
 
     void createInfo(const string& name)
        { if (verbose) cout << sformat(_("creating %s"), name.c_str()) << endl; 
}
@@ -823,7 +930,7 @@
        { cerr << sformat(_("failed to delete %s"), name.c_str()) << endl; }
 };
 
-RollbackCallbackImpl rollback_callback_impl;
+UndoCallbackImpl undo_callback_impl;
 
 
 int
@@ -842,7 +949,8 @@
     cmds["mount"] = command_mount;
     cmds["umount"] = command_umount;
     cmds["diff"] = command_diff;
-    cmds["rollback"] = command_rollback;
+    cmds["contentdiff"] = command_contentdiff;
+    cmds["undochange"] = command_undo;
     cmds["cleanup"] = command_cleanup;
     cmds["help"] = command_help;
 
@@ -933,7 +1041,7 @@
        if (!quiet)
        {
            sh->setCompareCallback(&compare_callback_impl);
-           sh->setRollbackCallback(&rollback_callback_impl);
+           sh->setUndoCallback(&undo_callback_impl);
        }
 
        (*cmd->second)();


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



Remember to have fun...

-- 
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to