Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
spadgos committed Oct 8, 2011
2 parents 7399adf + 83c70df commit 3a7ba04
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions git.py
Expand Up @@ -6,6 +6,12 @@
import functools
import tempfile

# when sublime loads a plugin it's cd'd into the plugin directory. Thus
# __file__ is useless for my purposes. What I want is "Packages/Git", but
# allowing for the possibility that someone has renamed the file.
# Fun discovery: Sublime on windows still requires posix path separators.
PLUGIN_DIRECTORY = os.getcwd().replace(os.path.normpath(os.path.join(os.getcwd(), '..', '..')) + os.path.sep, '').replace(os.path.sep, '/')


def main_thread(callback, *args, **kwargs):
# sublime.set_timeout gets used to send things onto the main thread
Expand Down Expand Up @@ -34,6 +40,10 @@ def view_contents(view):
return view.substr(region)


def plugin_file(name):
return os.path.join(PLUGIN_DIRECTORY, name)


def _make_text_safeish(text, fallback_encoding):
# The unicode decode here is because sublime converts to unicode inside
# insert in such a way that unknown characters will cause errors, which is
Expand Down Expand Up @@ -212,8 +222,7 @@ def panel_done(self, picked):
self.details_done)

def details_done(self, result):
print os.getcwd()
self.scratch(result, title="Git Commit Details", syntax="Git Commit Message.tmLanguage")
self.scratch(result, title="Git Commit Details", syntax=plugin_file("Git Commit Message.tmLanguage"))


class GitLogAllCommand(GitLogCommand):
Expand All @@ -230,7 +239,7 @@ def run(self, edit):
)

def log_done(self, result):
self.scratch(result, title="Git Log Graph", syntax="Git Graph.tmLanguage")
self.scratch(result, title="Git Log Graph", syntax=plugin_file("Git Graph.tmLanguage"))


class GitGraphAllCommand(GitGraphCommand):
Expand Down Expand Up @@ -327,7 +336,7 @@ def status_done(self, result):
msg = self.window().new_file()
msg.set_scratch(True)
msg.set_name("COMMIT_EDITMSG")
self._output_to_view(msg, template, syntax="Git Commit Message.tmLanguage")
self._output_to_view(msg, template, syntax=plugin_file("Git Commit Message.tmLanguage"))
msg.sel().clear()
msg.sel().add(sublime.Region(0, 0))
GitCommitCommand.active_message = self
Expand Down

0 comments on commit 3a7ba04

Please sign in to comment.