#! /usr/bin/env python
#
# This file is part of Advene.
#
# Advene is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# Advene is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Foobar; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
#

from pprint import pprint
from sys import argv, stderr

from libadvene.model.cam.package import Package
from libadvene.model.core.diff import diff_packages
from libadvene.model.core.element import PackageElement as Element

def main():
    if len(argv) != 3:
        print >>stderr, "usage: %s <package1> <package2>" % argv[0]
        exit(-1)
    p1 = Package(argv[1])
    p2 = Package(argv[2])
    pprint(diff_packages(p2, p1))

def friendly_repr(self):
    return "{%s %s}" % (self.__class__.__name__, self.id)

Element.__repr__ = friendly_repr

if __name__ == "__main__":
   main()
