# Path: sgit/util.py
# 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)
# 
# def noop(*args, **kwargs):
#     pass
# 
# Path: sgit/cmd.py
# class GitCmd(GitRepoHelper, Cmd):
#     executable = 'git'
#     bin = ['git']
#     opts = [
#         '--no-pager',
#         '-c', 'color.diff=false',
#         '-c', 'color.status=false',
#         '-c', 'color.branch=false',
#         '-c', 'status.displayCommentPrefix=true',
#         '-c', 'core.commentchar=#',
#     ]
# 
#     def git(self, cmd, *args, **kwargs):
#         return self.cmd(cmd, *args, **kwargs)
# 
#     def git_string(self, cmd, *args, **kwargs):
#         return self._string(cmd, *args, **kwargs)
# 
#     def git_lines(self, cmd, *args, **kwargs):
#         return self._lines(cmd, *args, **kwargs)
# 
#     def git_exit_code(self, cmd, *args, **kwargs):
#         return self._exit_code(cmd, *args, **kwargs)
# 
#     def git_async(self, cmd, *args, **kwargs):
#         return self.cmd_async(cmd, *args, **kwargs)
# 
# Path: sgit/helpers.py
# class GitTagHelper(object):
# 
#     def get_tags(self, repo, annotate=True):
#         if annotate:
#             return self.git_lines(['tag', '--list', '-n1'], cwd=repo)
#         else:
#             return self.git_lines(['tag', '--list', '-n0', '--no-column'], cwd=repo)
# 
#     def format_quick_tags(self, tags):
#         out = []
#         for t in reversed(tags):
#             tag, ann = t.split(' ', 1)
#             out.append([tag, ann.strip()])
#         return out
# 
# class GitErrorHelper(object):
# 
#     def format_error_message(self, msg):
#         if msg.startswith('error: '):
#             msg = msg[7:]
#         elif msg.lower().startswith('Note: '):
#             msg = msg[6:]
#         if msg.endswith('Aborting\n'):
#             msg = msg.rstrip()[:-8]
#         return msg


from functools import partial
from sublime_plugin import WindowCommand
from .util import StatusSpinner, noop
from .cmd import GitCmd
from .helpers import GitTagHelper, GitErrorHelper
import sublime
                    sublime.set_timeout(partial(self.on_tag, repo, tag), 50)

        self.window.show_quick_panel(choices, on_done)

    def on_tag(self, repo, tag):
        choices = [[a, t.format(tag=tag)] for a, t in self.TAG_ACTIONS]

        def on_done(idx):
            if idx != -1:
                action = self.TAG_ACTIONS[idx][0]
                callback = self.ACTION_CALLBACKS.get(action)

                func = getattr(self, callback, None)
                if func:
                    func(repo, tag)

        self.window.show_quick_panel(choices, on_done)

    def reset(self, repo):
        def on_time():
            self.window.run_command('git_tag', {'repo': repo})
        sublime.set_timeout(on_time, 50)

    # callbacks

    def verify_tag(self, repo, tag):
        self.panel = self.window.get_output_panel('git-tag')
        self.panel_shown = False

        thread = self.git_async(['tag', '--verify', tag], cwd=repo, on_data=self.on_data)

# Path: sgit/util.py
# 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)
# 
# def noop(*args, **kwargs):
#     pass
# 
# Path: sgit/cmd.py
# class GitCmd(GitRepoHelper, Cmd):
#     executable = 'git'
#     bin = ['git']
#     opts = [
#         '--no-pager',
#         '-c', 'color.diff=false',
#         '-c', 'color.status=false',
#         '-c', 'color.branch=false',
#         '-c', 'status.displayCommentPrefix=true',
#         '-c', 'core.commentchar=#',
#     ]
# 
#     def git(self, cmd, *args, **kwargs):
#         return self.cmd(cmd, *args, **kwargs)
# 
#     def git_string(self, cmd, *args, **kwargs):
#         return self._string(cmd, *args, **kwargs)
# 
#     def git_lines(self, cmd, *args, **kwargs):
#         return self._lines(cmd, *args, **kwargs)
# 
#     def git_exit_code(self, cmd, *args, **kwargs):
#         return self._exit_code(cmd, *args, **kwargs)
# 
#     def git_async(self, cmd, *args, **kwargs):
#         return self.cmd_async(cmd, *args, **kwargs)
# 
# Path: sgit/helpers.py
# class GitTagHelper(object):
# 
#     def get_tags(self, repo, annotate=True):
#         if annotate:
#             return self.git_lines(['tag', '--list', '-n1'], cwd=repo)
#         else:
#             return self.git_lines(['tag', '--list', '-n0', '--no-column'], cwd=repo)
# 
#     def format_quick_tags(self, tags):
#         out = []
#         for t in reversed(tags):
#             tag, ann = t.split(' ', 1)
#             out.append([tag, ann.strip()])
#         return out
# 
# class GitErrorHelper(object):
# 
#     def format_error_message(self, msg):
#         if msg.startswith('error: '):
#             msg = msg[7:]
#         elif msg.lower().startswith('Note: '):
#             msg = msg[6:]
#         if msg.endswith('Aborting\n'):
#             msg = msg.rstrip()[:-8]
#         return msg


# Path: sgit/tag.py
from functools import partial
from sublime_plugin import WindowCommand
from .util import StatusSpinner, noop
from .cmd import GitCmd
from .helpers import GitTagHelper, GitErrorHelper
import sublime

                    sublime.set_timeout(partial(self.on_tag, repo, tag), 50)

        self.window.show_quick_panel(choices, on_done)

    def on_tag(self, repo, tag):
        choices = [[a, t.format(tag=tag)] for a, t in self.TAG_ACTIONS]

        def on_done(idx):
            if idx != -1:
                action = self.TAG_ACTIONS[idx][0]
                callback = self.ACTION_CALLBACKS.get(action)

                func = getattr(self, callback, None)
                if func:
                    func(repo, tag)

        self.window.show_quick_panel(choices, on_done)

    def reset(self, repo):
        def on_time():
            self.window.run_command('git_tag', {'repo': repo})
        sublime.set_timeout(on_time, 50)

    # callbacks

    def verify_tag(self, repo, tag):
        self.panel = self.window.get_output_panel('git-tag')
        self.panel_shown = False

        thread = self.git_async(['tag', '--verify', tag], cwd=repo, on_data=self.on_data)

        runner = StatusSpinner(thread, "Verifying %s" % tag)