# Path: formatters/log.py
# class Log:
# 
#     DEBUG = False
# 
#     @staticmethod
#     def d(tag, message):
#         if Log.DEBUG: print "D/%s: %s" %(tag, message)
# 
#     @staticmethod
#     def i(tag, message):
#         print "I/%s: %s" %(tag, message)
# 
#     @staticmethod
#     def w(tag, message):
#         print "W/%s: %s" %(tag, message)
# 
#     @staticmethod
#     def e(tag, message):
#         print "E/%s: %s" %(tag, message)
# 
# class Paint:
# 
#     @staticmethod
#     def bold(s):
#         return "%s[01m%s%s[0m" % (chr(27), s.rstrip(), chr(27))
# 
#     @staticmethod
#     def red(s):
#         return "%s[33;31m%s%s[0m" % (chr(27), s.rstrip(), chr(27))
# 
#     @staticmethod
#     def green(s):
#         return "%s[31;32m%s%s[0m" % (chr(27), s.rstrip(), chr(27))
# 
#     @staticmethod
#     def blue(s):
#         return "%s[34;01m%s%s[0m" % (chr(27), s.rstrip(), chr(27))
# 
#     @staticmethod
#     def yellow(s):
#         return "%s[31;33m%s%s[0m" % (chr(27), s.rstrip(), chr(27))


import shutil
import subprocess
import os, sys
import tempfile
import commands
import getopt
from config import Config
from changelist import ChangeList
from formatters.log import Log, Paint

class CommitModel:
    """ The Commits Model of a device
    """

    def __init__(self, baseDevice):
        """ Initialize the commits model from a device path.
        """

        self.baseDevice = baseDevice
        self.commitIDs = []
        self.comments  = []

        baseDevice.fillCommitsInfo(self.commitIDs, self.comments)


    def showUserInputHint(self):
        """ Show user input hint
        """

        for i in range(0, len(self.commitIDs)):
            commitID = self.commitIDs[i]
            comment  = self.comments[i]
            print "  %s %s" % (Paint.bold(commitID), comment)

        deviceName = self.baseDevice.name()
        oneCommit  = Paint.bold(self.commitIDs[0])
        twoCommits = "%s %s" % (Paint.bold(self.commitIDs[-1]), Paint.bold(self.commitIDs[0]))
        print "  ________________________________________________________________________________________"
        print "                                                                                          "

# Path: formatters/log.py
# class Log:
# 
#     DEBUG = False
# 
#     @staticmethod
#     def d(tag, message):
#         if Log.DEBUG: print "D/%s: %s" %(tag, message)
# 
#     @staticmethod
#     def i(tag, message):
#         print "I/%s: %s" %(tag, message)
# 
#     @staticmethod
#     def w(tag, message):
#         print "W/%s: %s" %(tag, message)
# 
#     @staticmethod
#     def e(tag, message):
#         print "E/%s: %s" %(tag, message)
# 
# class Paint:
# 
#     @staticmethod
#     def bold(s):
#         return "%s[01m%s%s[0m" % (chr(27), s.rstrip(), chr(27))
# 
#     @staticmethod
#     def red(s):
#         return "%s[33;31m%s%s[0m" % (chr(27), s.rstrip(), chr(27))
# 
#     @staticmethod
#     def green(s):
#         return "%s[31;32m%s%s[0m" % (chr(27), s.rstrip(), chr(27))
# 
#     @staticmethod
#     def blue(s):
#         return "%s[34;01m%s%s[0m" % (chr(27), s.rstrip(), chr(27))
# 
#     @staticmethod
#     def yellow(s):
#         return "%s[31;33m%s%s[0m" % (chr(27), s.rstrip(), chr(27))


# Path: autopatch/precondition.py
import shutil
import subprocess
import os, sys
import tempfile
import commands
import getopt
from config import Config
from changelist import ChangeList
from formatters.log import Log, Paint


class CommitModel:
    """ The Commits Model of a device
    """

    def __init__(self, baseDevice):
        """ Initialize the commits model from a device path.
        """

        self.baseDevice = baseDevice
        self.commitIDs = []
        self.comments  = []

        baseDevice.fillCommitsInfo(self.commitIDs, self.comments)


    def showUserInputHint(self):
        """ Show user input hint
        """

        for i in range(0, len(self.commitIDs)):
            commitID = self.commitIDs[i]
            comment  = self.comments[i]
            print "  %s %s" % (Paint.bold(commitID), comment)

        deviceName = self.baseDevice.name()
        oneCommit  = Paint.bold(self.commitIDs[0])
        twoCommits = "%s %s" % (Paint.bold(self.commitIDs[-1]), Paint.bold(self.commitIDs[0]))
        print "  ________________________________________________________________________________________"
        print "                                                                                          "

        print "  Each 7 bits SHA1 code identify a commit on %s," % Paint.blue(deviceName),