#!/usr/bin/env python
#
# require's polib from https://bitbucket.org/izi/polib/wiki/Home
#
#   python-polib rpm or "easy_install polib"
#
#  cmp_pot_files po/old_keys.pot po/new_keys.pot
#
#  Should show any new strings between the two revs
#  example:
#  + this is a string in  new_keys
#  - this is a string that was in old_keys
#
#  Author: Adrian Likins <alikins@redhat.com>
#  License: GPLv3+
#
import polib
import sys

pot_file1 = sys.argv[1]
pot_file2 = sys.argv[2]

p1 = polib.pofile(pot_file1)
p2 = polib.pofile(pot_file2)

# all pot msgid's are "untranslated"
msgid_set_1 = set([msg.msgid for msg in p1.untranslated_entries()])
msgid_set_2 = set([msg.msgid for msg in p2.untranslated_entries()])


added_msgid_set = msgid_set_1 - msgid_set_2
missing_msgid_set = msgid_set_2 - msgid_set_1

for msg in added_msgid_set:
    print "+", msg

for msg in missing_msgid_set:
    print "-", msg

