# Path: sgit/util.py
# def noop(*args, **kwargs):
#     pass
# 
# class StatusSpinner(object):
# 
#     SIZE = 10  # 10 equal signs
#     TIME = 50  # 50 ms delay
# 
#     def __init__(self, thread, msg):
#         self.counter = 0
#         self.direction = 1
#         self.msg = msg
#         self.thread = thread
# 
#     def progress(self):
#         if not self.thread.is_alive():
#             sublime.status_message('')
#             return
# 
#         left, right = self.counter, (self.SIZE - 1 - self.counter)
#         self.counter += self.direction
#         if self.counter in (0, self.SIZE - 1):
#             self.direction *= -1
# 
#         status = "[%s=%s] %s" % (' ' * left, ' ' * right, self.msg)
# 
#         sublime.status_message(status)
#         sublime.set_timeout(self.progress, self.TIME)
# 
#     def start(self):
#         self.thread.start()
#         sublime.set_timeout(self.progress, 0)
# 
# Path: sgit/cmd.py
# class LegitCmd(GitRepoHelper, Cmd):
#     executable = 'legit'
#     bin = ['legit']
# 
#     def legit(self, cmd, *args, **kwargs):
#         return self.cmd(cmd, *args, **kwargs)
# 
#     def legit_string(self, cmd, *args, **kwargs):
#         return self._string(cmd, *args, **kwargs)
# 
#     def legit_lines(self, cmd, *args, **kwargs):
#         return self._lines(cmd, *args, **kwargs)
# 
#     def legit_exit_code(self, cmd, *args, **kwargs):
#         return self._exit_code(cmd, *args, **kwargs)
# 
#     def legit_async(self, cmd, *args, **kwargs):
#         return self.cmd_async(cmd, *args, **kwargs)


from functools import partial
from sublime_plugin import WindowCommand
from ..util import noop, StatusSpinner
from ..cmd import LegitCmd
import sublime
                panel.run_command('git_panel_write', {'content': out})
                self.window.run_command('show_panel', {'panel': 'output.legit-harvest'})

        self.show_branches_panel(repo, on_done)


class LegitSproutCommand(LegitWindowCmd, WindowCommand):
    """
    Documentation coming soon.
    """

    def run(self, select_branch=False):
        repo = self.get_repo()
        if not repo:
            return

        if select_branch:
            self.show_branches_panel(repo, partial(self.sprout, repo))
        else:
            self.sprout(repo)

    def sprout(self, repo, branch=None):
        def on_done(new_branch):
            new_branch = new_branch.strip()
            if new_branch:
                out = self.legit_string(['sprout', branch, new_branch], cwd=repo)
                panel = self.window.get_output_panel('legit-sprout')
                panel.run_command('git_panel_write', {'content': out})
                self.window.run_command('show_panel', {'panel': 'output.legit-sprout'})


# Path: sgit/util.py
# def noop(*args, **kwargs):
#     pass
# 
# class StatusSpinner(object):
# 
#     SIZE = 10  # 10 equal signs
#     TIME = 50  # 50 ms delay
# 
#     def __init__(self, thread, msg):
#         self.counter = 0
#         self.direction = 1
#         self.msg = msg
#         self.thread = thread
# 
#     def progress(self):
#         if not self.thread.is_alive():
#             sublime.status_message('')
#             return
# 
#         left, right = self.counter, (self.SIZE - 1 - self.counter)
#         self.counter += self.direction
#         if self.counter in (0, self.SIZE - 1):
#             self.direction *= -1
# 
#         status = "[%s=%s] %s" % (' ' * left, ' ' * right, self.msg)
# 
#         sublime.status_message(status)
#         sublime.set_timeout(self.progress, self.TIME)
# 
#     def start(self):
#         self.thread.start()
#         sublime.set_timeout(self.progress, 0)
# 
# Path: sgit/cmd.py
# class LegitCmd(GitRepoHelper, Cmd):
#     executable = 'legit'
#     bin = ['legit']
# 
#     def legit(self, cmd, *args, **kwargs):
#         return self.cmd(cmd, *args, **kwargs)
# 
#     def legit_string(self, cmd, *args, **kwargs):
#         return self._string(cmd, *args, **kwargs)
# 
#     def legit_lines(self, cmd, *args, **kwargs):
#         return self._lines(cmd, *args, **kwargs)
# 
#     def legit_exit_code(self, cmd, *args, **kwargs):
#         return self._exit_code(cmd, *args, **kwargs)
# 
#     def legit_async(self, cmd, *args, **kwargs):
#         return self.cmd_async(cmd, *args, **kwargs)


# Path: sgit/git_extensions/legit.py
from functools import partial
from sublime_plugin import WindowCommand
from ..util import noop, StatusSpinner
from ..cmd import LegitCmd
import sublime

                panel.run_command('git_panel_write', {'content': out})
                self.window.run_command('show_panel', {'panel': 'output.legit-harvest'})

        self.show_branches_panel(repo, on_done)


class LegitSproutCommand(LegitWindowCmd, WindowCommand):
    """
    Documentation coming soon.
    """

    def run(self, select_branch=False):
        repo = self.get_repo()
        if not repo:
            return

        if select_branch:
            self.show_branches_panel(repo, partial(self.sprout, repo))
        else:
            self.sprout(repo)

    def sprout(self, repo, branch=None):
        def on_done(new_branch):
            new_branch = new_branch.strip()
            if new_branch:
                out = self.legit_string(['sprout', branch, new_branch], cwd=repo)
                panel = self.window.get_output_panel('legit-sprout')
                panel.run_command('git_panel_write', {'content': out})
                self.window.run_command('show_panel', {'panel': 'output.legit-sprout'})


        self.window.show_input_panel('New branch:', '', on_done, noop, noop)