From 7e1014b1888596d01e28b36e645116ae1e37b7cc Mon Sep 17 00:00:00 2001 From: David Aguilar Date: Sun, 6 Apr 2008 03:47:51 -0700 Subject: [PATCH] cmds: teach format-patch about the dispatcher Signed-off-by: David Aguilar --- ugit/controllers.py | 2 +- ugit/git.py | 22 ++++++++++++---------- ugit/models.py | 1 + 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/ugit/controllers.py b/ugit/controllers.py index b3455e1..2fbd7cc 100644 --- a/ugit/controllers.py +++ b/ugit/controllers.py @@ -331,7 +331,7 @@ class Controller(QObserver): commits = self.select_commits_gui(self.tr('Export Patches'), revs, summaries) if not commits: return - self.log(self.model.format_patch(commits)) + self.log(self.model.format_patch_helper(commits)) def quit_app(self,*rest): """Save config settings and cleanup any inotify threads.""" diff --git a/ugit/git.py b/ugit/git.py index 6d5029b..2a42ba6 100644 --- a/ugit/git.py +++ b/ugit/git.py @@ -201,21 +201,23 @@ def diffindex(): stat=True, cached=True) -def format_patch(revs): +def format_patch_helper(revs): """writes patches named by revs to the "patches" directory.""" num_patches = 1 output = [] - kwargs = { - 'o': 'patches', - 'n': len(revs) > 1, - 'thread': True, - 'patch-with-stat': True, - } for idx, rev in enumerate(revs): real_idx = idx + num_patches - kwargs['start-number'] = real_idx - revarg = '%s^..%s'%(rev,rev) - output.append(git('format-patch', revarg, **kwargs)) + revarg = '%s^..%s' % (rev,rev) + output.append( + gitcmd.format_patch( + revarg, + o='patches', + start_number=real_idx, + n=len(revs) > 1, + thread=True, + patch_with_stat=True + ) + ) num_patches += output[-1].count('\n') return '\n'.join(output) diff --git a/ugit/models.py b/ugit/models.py index c11065e..ca90a10 100644 --- a/ugit/models.py +++ b/ugit/models.py @@ -39,6 +39,7 @@ class Model(model.Model): 'diffstat', 'diffindex', 'format_patch', + 'format_patch_helper', 'push', 'show', 'log', -- 2.11.4.GIT