Skip to content

Commit

Permalink
Other: the id may not be sequential
Browse files Browse the repository at this point in the history
  • Loading branch information
randy3k committed Aug 31, 2017
1 parent 405eb0a commit 78889b6
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
30 changes: 15 additions & 15 deletions core/commands/stash.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ def run(self, stash_id=None):
else:
self.do_apply(stash_id)

def do_apply(self, id):
if id == -1:
def do_apply(self, stash_id):
if stash_id is None:
return

self.apply_stash(id)
self.apply_stash(stash_id)
util.view.refresh_gitsavvy(self.window.active_view())


Expand All @@ -37,11 +37,11 @@ def run(self, stash_id=None):
else:
self.do_pop(stash_id)

def do_pop(self, id):
if id == -1:
def do_pop(self, stash_id):
if stash_id is None:
return

self.pop_stash(id)
self.pop_stash(stash_id)
util.view.refresh_gitsavvy(self.window.active_view())


Expand All @@ -59,12 +59,12 @@ def run(self, stash_ids=[]):
for stash_id in stash_ids:
self.do_show(stash_id)

def do_show(self, id):
if id == -1:
def do_show(self, stash_id):
if stash_id is None:
return

stash_view = self.get_stash_view("stash@{{{}}}".format(id))
stash_view.run_command("gs_replace_view_text", {"text": self.show_stash(id), "nuke_cursors": True})
stash_view = self.get_stash_view("stash@{{{}}}".format(stash_id))
stash_view.run_command("gs_replace_view_text", {"text": self.show_stash(stash_id), "nuke_cursors": True})

def get_stash_view(self, title):
window = self.window if hasattr(self, "window") else self.view.window()
Expand Down Expand Up @@ -129,11 +129,11 @@ def run(self, stash_id=None):
else:
self.do_drop(stash_id)

def do_drop(self, id):
if id == -1:
def do_drop(self, stash_id):
if stash_id is None:
return

@util.actions.destructive(description="drop a stash")
def do_drop_stash(id):
self.drop_stash(id)
do_drop_stash(id)
def do_drop_stash(stash_id):
self.drop_stash(stash_id)
do_drop_stash(stash_id)
2 changes: 1 addition & 1 deletion core/ui_mixins/quick_panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -520,4 +520,4 @@ def __init__(self, on_done, **kwargs):
super().__init__(self.get_stashes(), on_done, **kwargs)

def format_item(self, entry):
return entry.id + " " + entry.description
return (entry.id + " " + entry.description, entry.id)

0 comments on commit 78889b6

Please sign in to comment.