Author: jsuchome Date: Mon Feb 7 14:39:42 2011 New Revision: 63360 URL: http://svn.opensuse.org/viewcvs/yast?rev=63360&view=rev Log: return different files as a result of diff call temp. add here statusToString function Modified: branches/tmp/jsuchome/snapper/agent-snapper/src/SnapperAgent.cc Modified: branches/tmp/jsuchome/snapper/agent-snapper/src/SnapperAgent.cc URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/jsuchome/snapper/agent-snapper/src/SnapperAgent.cc?rev=63360&r1=63359&r2=63360&view=diff ============================================================================== --- branches/tmp/jsuchome/snapper/agent-snapper/src/SnapperAgent.cc (original) +++ branches/tmp/jsuchome/snapper/agent-snapper/src/SnapperAgent.cc Mon Feb 7 14:39:42 2011 @@ -45,6 +45,28 @@ return deflt; } +string statusToString(unsigned int status) +{ + string ret; + + if (status & CREATED) + ret += "+"; + else if (status & DELETED) + ret += "-"; + else if (status & TYPE) + ret += "t"; + else if (status & CONTENT) + ret += "c"; + else + ret += "."; + + ret += status & PERMISSIONS ? "p" : "."; + ret += status & USER ? "u" : "."; + ret += status & GROUP ? "g" : "."; + + return ret; +} + /** * Constructor */ @@ -128,7 +150,7 @@ * Read(.snapper.diff) -> show difference between snapnots num1 and num2. */ if (PC(0) == "diff") { - YCPMap retmap; + YCPList retlist; unsigned int num1 = getIntValue (argmap, "from", 0); unsigned int num2 = getIntValue (argmap, "to", 0); @@ -138,12 +160,14 @@ const Files& files = sh->getFiles(); for (Files::const_iterator it = files.begin(); it != files.end(); ++it) { -// cout << statusToString(it->getPreToPostStatus()) << " " << it->getName() << endl; + YCPMap filemap; y2internal ("file :%s ", it->getName().c_str ()); - y2internal ("status: %d", it->getPreToPostStatus()); + y2internal ("pre to post status: %d", it->getPreToPostStatus()); + filemap->add (YCPString ("name"), YCPString (it->getName())); + filemap->add (YCPString ("changes"), YCPString (statusToString (it->getPreToPostStatus()))); + retlist->add (filemap); } - - return retmap; + return retlist; } else { y2error("Wrong path '%s' in Read().", path->toString().c_str()); -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org