# Path: memacs/svn.py
# class SvnMemacs(Memacs):
#     def _parser_add_arguments(self):
#         """
#         overwritten method of class Memacs
# 
#         add additional arguments
#         """
#         Memacs._parser_add_arguments(self)
# 
#         self._parser.add_argument(
#             "-f", "--file", dest="svnlogxmlfile",
#             action="store",
#             help="path to a an file which contains output from " + \
#                 " following svn command: svn log --xml")
# 
#         self._parser.add_argument(
#            "-g", "--grep-author", dest="grepauthor",
#            action="store",
#            help="if you wanna parse only messages from a specific person. " + \
#            "format:<author> of author to grep")
# 
#     def _parser_parse_args(self):
#         """
#         overwritten method of class Memacs
# 
#         all additional arguments are parsed in here
#         """
#         Memacs._parser_parse_args(self)
#         if self._args.svnlogxmlfile and not \
#                 (os.path.exists(self._args.svnlogxmlfile) or \
#                      os.access(self._args.svnlogxmlfile, os.R_OK)):
#             self._parser.error("input file not found or not readable")
# 
#     def _main(self):
#         """
#         get's automatically called from Memacs class
#         read the lines from svn xml file, parse and write them to org file
#         """
# 
#         # read file
#         if self._args.svnlogxmlfile:
#             logging.debug("using as %s input_stream", self._args.svnlogxmlfile)
#             data = CommonReader.get_data_from_file(self._args.svnlogxmlfile)
#         else:
#             logging.info("Using stdin as input_stream")
#             data = CommonReader.get_data_from_stdin()
# 
#         try:
#             xml.sax.parseString(data.encode('utf-8'),
#                                 SvnSaxHandler(self._writer,
#                                               self._args.grepauthor))
#         except SAXParseException:
#             logging.error("No correct XML given")
#             sys.exit(1)


from memacs.svn import SvnMemacs


PROG_VERSION_NUMBER = "0.1"
PROG_VERSION_DATE = "2011-12-27"
PROG_SHORT_DESCRIPTION = "Memacs for svn"
PROG_TAG = "svn"
PROG_DESCRIPTION = """
This Memacs module will parse output of svn log --xml

sample xml:
 <?xml version="1.0"?>
    <log>
    <logentry
       revision="13">
    <author>bob</author>
    <date>2011-11-05T18:18:22.936127Z</date>
    <msg>Bugfix.</msg>
    </logentry>
    </log>

Then an Org-mode file is generated that contains information
about the log messages, author, and revision
"""
COPYRIGHT_YEAR = "2011-2013"
COPYRIGHT_AUTHORS = """Karl Voit <tools@Karl-Voit.at>,
Armin Wieser <armin.wieser@gmail.com>"""


def main():
    global memacs

# Path: memacs/svn.py
# class SvnMemacs(Memacs):
#     def _parser_add_arguments(self):
#         """
#         overwritten method of class Memacs
# 
#         add additional arguments
#         """
#         Memacs._parser_add_arguments(self)
# 
#         self._parser.add_argument(
#             "-f", "--file", dest="svnlogxmlfile",
#             action="store",
#             help="path to a an file which contains output from " + \
#                 " following svn command: svn log --xml")
# 
#         self._parser.add_argument(
#            "-g", "--grep-author", dest="grepauthor",
#            action="store",
#            help="if you wanna parse only messages from a specific person. " + \
#            "format:<author> of author to grep")
# 
#     def _parser_parse_args(self):
#         """
#         overwritten method of class Memacs
# 
#         all additional arguments are parsed in here
#         """
#         Memacs._parser_parse_args(self)
#         if self._args.svnlogxmlfile and not \
#                 (os.path.exists(self._args.svnlogxmlfile) or \
#                      os.access(self._args.svnlogxmlfile, os.R_OK)):
#             self._parser.error("input file not found or not readable")
# 
#     def _main(self):
#         """
#         get's automatically called from Memacs class
#         read the lines from svn xml file, parse and write them to org file
#         """
# 
#         # read file
#         if self._args.svnlogxmlfile:
#             logging.debug("using as %s input_stream", self._args.svnlogxmlfile)
#             data = CommonReader.get_data_from_file(self._args.svnlogxmlfile)
#         else:
#             logging.info("Using stdin as input_stream")
#             data = CommonReader.get_data_from_stdin()
# 
#         try:
#             xml.sax.parseString(data.encode('utf-8'),
#                                 SvnSaxHandler(self._writer,
#                                               self._args.grepauthor))
#         except SAXParseException:
#             logging.error("No correct XML given")
#             sys.exit(1)


# Path: bin/memacs_svn.py
from memacs.svn import SvnMemacs



PROG_VERSION_NUMBER = "0.1"
PROG_VERSION_DATE = "2011-12-27"
PROG_SHORT_DESCRIPTION = "Memacs for svn"
PROG_TAG = "svn"
PROG_DESCRIPTION = """
This Memacs module will parse output of svn log --xml

sample xml:
 <?xml version="1.0"?>
    <log>
    <logentry
       revision="13">
    <author>bob</author>
    <date>2011-11-05T18:18:22.936127Z</date>
    <msg>Bugfix.</msg>
    </logentry>
    </log>

Then an Org-mode file is generated that contains information
about the log messages, author, and revision
"""
COPYRIGHT_YEAR = "2011-2013"
COPYRIGHT_AUTHORS = """Karl Voit <tools@Karl-Voit.at>,
Armin Wieser <armin.wieser@gmail.com>"""


def main():
    global memacs

    memacs = SvnMemacs(