From f6b3e091dba80ae2d28446cf16ffe6d486f2817e Mon Sep 17 00:00:00 2001 From: David Aguilar Date: Sun, 6 Apr 2008 03:57:58 -0700 Subject: [PATCH] cmds: simplify cherry-pick by using the dispatcher Signed-off-by: David Aguilar --- ugit/controllers.py | 2 +- ugit/git.py | 16 ++++------------ ugit/models.py | 1 + 3 files changed, 6 insertions(+), 13 deletions(-) diff --git a/ugit/controllers.py b/ugit/controllers.py index 2fbd7cc..4434b70 100644 --- a/ugit/controllers.py +++ b/ugit/controllers.py @@ -264,7 +264,7 @@ class Controller(QObserver): commits = self.select_commits_gui(self.tr('Cherry-Pick Commits'), *self.model.log(all=True)) if not commits: return - self.log(self.model.cherry_pick(commits)) + self.log(self.model.cherry_pick_list(commits)) def commit(self): msg = self.model.get_commitmsg() diff --git a/ugit/git.py b/ugit/git.py index 2a42ba6..49f1371 100644 --- a/ugit/git.py +++ b/ugit/git.py @@ -79,22 +79,14 @@ def branch(name=None, remote=False, delete=False): return remotes return branches -def cherry_pick(revs, commit=False): +def cherry_pick_list(revs, **kwargs): """Cherry-picks each revision into the current branch. Returns a list of command output strings (1 per cherry pick)""" - - if not revs: return [] - - argv = [ 'cherry-pick' ] - kwargs = {} - if not commit: - kwargs['n'] = True - + if not revs: + return [] cherries = [] for rev in revs: - new_argv = argv + [rev] - cherries.append(git(*new_argv, **kwargs)) - + cherries.append(gitcmd.cherry_pick(rev, **kwargs)) return '\n'.join(cherries) def commit_with_msg(msg, amend=False): diff --git a/ugit/models.py b/ugit/models.py index ca90a10..3b92686 100644 --- a/ugit/models.py +++ b/ugit/models.py @@ -33,6 +33,7 @@ class Model(model.Model): 'checkout', 'create_branch', 'cherry_pick', + 'cherry_pick_list', 'commit_with_msg', 'diff', 'diff_helper', -- 2.11.4.GIT