Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add prune option for fetch #680

Merged
merged 1 commit into from
Apr 10, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion cola/models/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,8 @@ def remote_args(remote,
rebase=False,
pull=False,
push=False,
set_upstream=False):
set_upstream=False,
prune=False):
"""Return arguments for git fetch/push/pull"""

args = [remote]
Expand All @@ -542,6 +543,8 @@ def remote_args(remote,
kwargs['set_upstream'] = True
if tags:
kwargs['tags'] = True
if prune:
kwargs['prune'] = True

return (args, kwargs)

Expand Down
9 changes: 9 additions & 0 deletions cola/widgets/remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ def __init__(self, model, action, title, parent=None, icon=None):
tooltip=tooltip)

self.tags_checkbox = qtutils.checkbox(text=N_('Include tags '))
self.prune_checkbox = qtutils.checkbox(text=N_('Prune '))

tooltip = N_('Rebase the current branch instead of merging')
self.rebase_checkbox = qtutils.checkbox(text=N_('Rebase'),
Expand Down Expand Up @@ -226,6 +227,7 @@ def __init__(self, model, action, title, parent=None, icon=None):
self.ff_only_checkbox,
self.no_ff_checkbox,
self.tags_checkbox,
self.prune_checkbox,
self.rebase_checkbox,
self.upstream_checkbox,
self.prompt_checkbox,
Expand Down Expand Up @@ -298,6 +300,8 @@ def __init__(self, model, action, title, parent=None, icon=None):

qtutils.add_action(self, N_('Close'), self.close,
QtGui.QKeySequence.Close, 'Esc')
if action != FETCH:
self.prune_checkbox.hide()

if action != PUSH:
# Push-only options
Expand Down Expand Up @@ -475,6 +479,7 @@ def common_args(self):
rebase = self.rebase_checkbox.isChecked()
set_upstream = self.upstream_checkbox.isChecked()
tags = self.tags_checkbox.isChecked()
prune = self.prune_checkbox.isChecked()

return (remote_name,
{
Expand All @@ -486,6 +491,7 @@ def common_args(self):
'remote_branch': remote_branch,
'set_upstream': set_upstream,
'tags': tags,
'prune': prune,
})

# Actions
Expand Down Expand Up @@ -608,13 +614,16 @@ def export_state(self):
"""Export persistent settings"""
state = RemoteActionDialog.export_state(self)
state['tags'] = self.tags_checkbox.isChecked()
state['prune'] = self.prune_checkbox.isChecked()
return state

def apply_state(self, state):
"""Apply persistent settings"""
result = RemoteActionDialog.apply_state(self, state)
tags = bool(state.get('tags', False))
self.tags_checkbox.setChecked(tags)
prune = bool(state.get('prune', False))
self.prune_checkbox.setChecked(prune)
return result


Expand Down