Skip to content

Commit

Permalink
Merge pull request #983 from divmain/release/2.17.4
Browse files Browse the repository at this point in the history
Release/2.17.4
  • Loading branch information
randy3k committed Aug 22, 2018
2 parents 0f56814 + b0d95ed commit 3c2e064
Show file tree
Hide file tree
Showing 39 changed files with 359 additions and 179 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ Please include the following information when filing a bug:
- Console error output
- A description of the problem.
- Steps to reproduce, if possible
- If the bug is caused by a failing command, [include a debug log](docs/debug.md#providing-a-debug-log).
- If the bug is caused by a failing command, [include a debug log](https://github.com/divmain/GitSavvy/blob/master/docs/debug.md#providing-a-debug-log).
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ matrix:
language: generic

before_install:
- curl -OL https://raw.githubusercontent.com/randy3k/UnitTesting/master/sbin/travis.sh
- curl -OL https://raw.githubusercontent.com/SublimeText/UnitTesting/master/sbin/travis.sh
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then
export DISPLAY=:99.0;
sh -e /etc/init.d/xvfb start;
Expand Down
8 changes: 8 additions & 0 deletions Default (Linux).sublime-keymap
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,14 @@
{ "key": "setting.git_savvy.get_long_text_view", "operator": "equal", "operand": true }
]
},
{
"keys": ["ctrl+w"],
"command": "gs_commit_view_close",
"context": [
{ "key": "setting.command_mode", "operator": "equal", "operand": false },
{ "key": "setting.git_savvy.commit_view", "operator": "equal", "operand": true }
]
},

///////////////
// DIFF VIEW //
Expand Down
18 changes: 18 additions & 0 deletions Default (OSX).sublime-keymap
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,14 @@
{ "key": "setting.git_savvy.get_long_text_view", "operator": "equal", "operand": true }
]
},
{
"keys": ["super+w"],
"command": "gs_commit_view_close",
"context": [
{ "key": "setting.command_mode", "operator": "equal", "operand": false },
{ "key": "setting.git_savvy.commit_view", "operator": "equal", "operand": true }
]
},

///////////////
// DIFF VIEW //
Expand Down Expand Up @@ -242,5 +250,15 @@
"context": [
{ "key": "selector", "operator": "equal", "operand": "git-savvy.tags" }
]
},

/////////////////////////////
// SINGLE LINE INPUT PANEL //
////////////////////////////

{
"keys": ["super+enter"],
"command": "noop",
"context": [{ "key": "setting.git_savvy.single_line_input_panel" }]
}
]
9 changes: 8 additions & 1 deletion Default (Windows).sublime-keymap
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,14 @@
{ "key": "setting.git_savvy.get_long_text_view", "operator": "equal", "operand": true }
]
},

{
"keys": ["ctrl+w"],
"command": "gs_commit_view_close",
"context": [
{ "key": "setting.command_mode", "operator": "equal", "operand": false },
{ "key": "setting.git_savvy.commit_view", "operator": "equal", "operand": true }
]
},

///////////////
// DIFF VIEW //
Expand Down
5 changes: 5 additions & 0 deletions Default.sublime-commands
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,11 @@
"command": "gs_push",
"args": { "force": true }
},
{
"caption": "git: push (force-with-lease)",
"command": "gs_push",
"args": { "force_with_lease": true }
},
{
"caption": "git: push all tags",
"command": "gs_tags_push",
Expand Down
15 changes: 15 additions & 0 deletions Default.sublime-keymap
Original file line number Diff line number Diff line change
Expand Up @@ -1818,5 +1818,20 @@
{ "key": "setting.git_savvy.git-rebase-todo_view", "operator": "equal", "operand": true },
{ "key": "selector", "operator": "equal", "operand": "git-savvy.rebase.interactive meta.git-savvy.rebase-interactive.line" }
]
},

/////////////////////////////
// SINGLE LINE INPUT PANEL //
////////////////////////////

{
"keys": ["shift+enter"],
"command": "noop",
"context": [{ "key": "setting.git_savvy.single_line_input_panel" }]
},
{
"keys": ["ctrl+enter"],
"command": "noop",
"context": [{ "key": "setting.git_savvy.single_line_input_panel" }]
}
]
6 changes: 3 additions & 3 deletions GitSavvy.sublime-project
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
{
"GitSavvy":
{
},
"build_systems":
[
{
Expand All @@ -26,6 +23,9 @@
],
"settings":
{
"GitSavvy":
{
},
"rulers":
[
100,
Expand Down
10 changes: 5 additions & 5 deletions GitSavvy.sublime-settings
Original file line number Diff line number Diff line change
Expand Up @@ -281,9 +281,9 @@

/*
When set to `true`, GitSavvy will prompt for confirmation when closing
the commit message view.
the commit message view. Ignored when "commit_on_close" is true.
*/
"prompt_on_abort_commit": false,
"prompt_on_abort_commit": true,

/*
When set to `true`, GitSavvy will display git-flow integration commands.
Expand Down Expand Up @@ -315,9 +315,9 @@
"confirm_force_push": true,

/*
When set to `true`, closing the commit message window will result in a commit
action being taken, except in cases where the message is empty. The same is
also true for amending commits.
When set to `true`, closing the commit message window via keyboard will result
in a commit action being taken, except in cases where the message is empty.
The same is also true for amending commits.
*/
"commit_on_close": false,

Expand Down
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ environment:
install:
- ps: git config --global user.email gitsavvy@gitsavvy.com
- ps: git config --global user.name GitSavvy
- ps: appveyor DownloadFile "https://raw.githubusercontent.com/randy3k/UnitTesting/master/sbin/appveyor.ps1"
- ps: appveyor DownloadFile "https://raw.githubusercontent.com/SublimeText/UnitTesting/master/sbin/appveyor.ps1"
- ps: .\appveyor.ps1 "bootstrap" -verbose
- ps: .\appveyor.ps1 "install_package_control" -verbose
- ps: python -m pip install --upgrade pip
Expand Down
27 changes: 20 additions & 7 deletions common/global_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,20 @@ def on_pre_close(self, view):
view.run_command("save")


PROJECT_MSG = """
<body>
<p>Add the key <code>"GitSavvy"</code> as follows</p>
{<br>
&nbsp;&nbsp;"settings": {<br>
&nbsp;&nbsp;&nbsp;&nbsp;"GitSavvy": {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// GitSavvy settings go here<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;}<br>
}
</body>
"""


class KeyboardSettingsListener(EventListener):
def on_post_window_command(self, window, command, args):
if command == "edit_settings":
Expand All @@ -56,6 +70,11 @@ def on_post_window_command(self, window, command, args):
w.focus_group(0)
w.run_command("open_file", {"file": "${packages}/GitSavvy/Default.sublime-keymap"})
w.focus_group(1)
elif base.endswith("GitSavvy.sublime-settings"):
w = sublime.active_window()
view = w.active_view()
sublime.set_timeout(
lambda: view.show_popup(PROJECT_MSG), 1000)


class GsEditSettingsCommand(WindowCommand):
Expand All @@ -79,13 +98,7 @@ def run(self):
project_data = self.window.project_data()
if not project_file_name or project_data is None:
sublime.error_message("No project data found.")

if project_data is None:
project_data = {}
if "GitSavvy" not in project_data:
project_data["GitSavvy"] = {}

self.window.set_project_data(project_data)
return

sublime.set_timeout(lambda: self.window.run_command("edit_settings", {
"user_file": project_file_name,
Expand Down
2 changes: 0 additions & 2 deletions common/util/view.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,6 @@ def handle_closed_view(view):
view.run_command("gs_interface_close")
if view.settings().get("git_savvy.edit_view"):
view.run_command("gs_edit_view_close")
if view.settings().get("git_savvy.commit_view"):
view.run_command("gs_commit_view_close")


############################
Expand Down
3 changes: 2 additions & 1 deletion core/commands/changelog.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from sublime_plugin import WindowCommand

from ..git_command import GitCommand
from ..ui_mixins.input_panel import show_single_line_input_panel

REF_PROMPT = "Ref or commit hash:"

Expand All @@ -28,7 +29,7 @@ def run(self):
sublime.set_timeout_async(self.run_async, 0)

def run_async(self):
view = self.window.show_input_panel(
view = show_single_line_input_panel(
REF_PROMPT, self.get_last_local_tag(), self.on_done, None, None)
view.run_command("select_all")

Expand Down
46 changes: 38 additions & 8 deletions core/commands/checkout.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from .log import LogMixin
from ...common import util
from ..ui_mixins.quick_panel import show_branch_panel
from ..ui_mixins.input_panel import show_single_line_input_panel


NEW_BRANCH_PROMPT = "Branch name:"
Expand Down Expand Up @@ -50,9 +51,8 @@ def run(self, base_branch=None):

def run_async(self, base_branch=None, new_branch=None):
self.base_branch = base_branch
v = self.window.show_input_panel(
NEW_BRANCH_PROMPT, new_branch or base_branch or "", self.on_done, None, None)
v.run_command("select_all")
show_single_line_input_panel(
NEW_BRANCH_PROMPT, new_branch or base_branch or "", self.on_done)

def on_done(self, branch_name):
if not self.validate_branch_name(branch_name):
Expand Down Expand Up @@ -97,13 +97,10 @@ def on_branch_selection(self, remote_branch, local_name=None):
self.remote_branch = remote_branch
if not local_name:
local_name = remote_branch.split("/", 1)[1]
v = self.window.show_input_panel(
show_single_line_input_panel(
NEW_BRANCH_PROMPT,
local_name,
self.on_enter_local_name,
None,
None)
v.run_command("select_all")
self.on_enter_local_name)

def on_enter_local_name(self, branch_name):
if not self.validate_branch_name(branch_name):
Expand All @@ -130,6 +127,15 @@ def run(self):
if self.file_path:
super().run(file_path=self.file_path)

def on_highlight(self, commit):
if not self.savvy_settings.get("log_show_more_commit_info", True):
return
if commit:
self.window.run_command('gs_show_file_diff', {
'commit_hash': commit,
'file_path': self.file_path
})

@util.actions.destructive(description="discard uncommitted changes to file")
def do_action(self, commit_hash, **kwargs):
if commit_hash:
Expand All @@ -141,3 +147,27 @@ def do_action(self, commit_hash, **kwargs):
)
)
util.view.refresh_gitsavvy_interfaces(self.window, interface_reset_cursor=True)


class GsShowFileDiffCommand(WindowCommand, GitCommand):
def run(self, commit_hash, file_path):
self._commit_hash = commit_hash
self._file_path = file_path
sublime.set_timeout_async(self.run_async)

def run_async(self):
text = self.git(
"diff",
"--no-color",
"-R",
self._commit_hash,
'--',
self._file_path
)

output_view = self.window.create_output_panel("show_file_diff")
output_view.set_read_only(False)
output_view.run_command("gs_replace_view_text", {"text": text, "nuke_cursors": True})
output_view.set_syntax_file("Packages/GitSavvy/syntax/diff.sublime-syntax")
output_view.set_read_only(True)
self.window.run_command("show_panel", {"panel": "output.show_file_diff"})

0 comments on commit 3c2e064

Please sign in to comment.