def log(self, n=None, **kwargs):
        """
        Run the repository log command

        Returns:
            str: output of log command (``git log -n <n> <--kwarg=value>``)
        """
        kwargs['format'] = kwargs.pop('template', self.template)
        cmd = ['git', 'log']
        if n:
            cmd.append('-n%d' % n)
        cmd.extend(
            (('--%s=%s' % (k, v))
             for (k, v) in iteritems(kwargs)))
        try:
            output = self.sh(cmd, shell=False)
            if "fatal: bad default revision 'HEAD'" in output:
                return output
            return output
        except Exception as e:
            e
            return