@@ -0,0 +1,1328 @@
+# pylint: disable=C0111,R0903%0A%0A%22%22%22Print the branch and git status for the%0Acurrently focused window.%0A%0ARequires:%0A    * xcwd%0A    * Python module 'pygit2'%0A%22%22%22%0A%0Aimport os%0Aimport string%0Aimport pygit2%0A%0Aimport bumblebee.input%0Aimport bumblebee.output%0Aimport bumblebee.engine%0Aimport bumblebee.util%0A%0Aclass Module(bumblebee.engine.Module):%0A    def __init__(self, engine, config):%0A        super(Module, self).__init__(engine, config,%0A            bumblebee.output.Widget(full_text=self.gitinfo)%0A        )%0A        self._fmt = self.parameter(%22format%22, %22%7Bbranch%7D%22)%0A%0A    def gitinfo(self, widget):%0A        info = %22%22%0A        directory = None%0A        data = %7B%0A            %22branch%22: %22n/a%22,%0A        %7D%0A        try:%0A            directory = bumblebee.util.execute(%22xcwd%22).strip()%0A            directory = self._get_git_root(directory)%0A            repo = pygit2.Repository(directory)%0A            data%5B%22branch%22%5D = repo.head.shorthand%0A        except Exception as e:%0A            return e%0A%0A        return string.Formatter().vformat(self._fmt, (), data)%0A%0A    def _get_git_root(self, directory):%0A        while directory != %22/%22:%0A            if os.path.exists(os.path.join(directory, %22.git%22)):%0A                return directory%0A            directory = %22/%22.join(directory.split(%22/%22)%5B0:-1%5D)%0A        return None%0A%0A# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4%0A

Add new module to display git information