git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Catalin Marinas <catalin.marinas@gmail.com>
To: git@vger.kernel.org, "Karl Hasselström" <kha@treskal.com>
Subject: [StGit PATCH] Add --file option to pick
Date: Wed, 14 Jan 2009 22:59:30 +0000	[thread overview]
Message-ID: <20090114225930.11098.2144.stgit@localhost.localdomain> (raw)

This allows folding of specific files only.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
---
 stgit/commands/pick.py |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/stgit/commands/pick.py b/stgit/commands/pick.py
index ee08c01..b0e9114 100644
--- a/stgit/commands/pick.py
+++ b/stgit/commands/pick.py
@@ -52,6 +52,8 @@ options = [
         short = 'Fold the commit object into the current patch'),
     opt('--update', action = 'store_true',
         short = 'Like fold but only update the current patch files'),
+    opt('-f', '--files', action = 'append',
+        short = 'Only fold the given files'),
     opt('--unapplied', action = 'store_true',
         short = 'Keep the patch unapplied')]
 
@@ -83,8 +85,11 @@ def __pick_commit(commit_id, patchname, options):
         out.start('Folding commit %s' % commit_id)
 
         # try a direct git apply first
-        if not git.apply_diff(bottom, top):
-            git.merge_recursive(bottom, git.get_head(), top)
+        if not git.apply_diff(bottom, top, files = options.files):
+            if options.files:
+                raise CmdException, 'Patch folding failed'
+            else:
+                git.merge_recursive(bottom, git.get_head(), top)
 
         out.done()
     elif options.update:
@@ -152,6 +157,9 @@ def func(parser, options, args):
     if not args:
         parser.error('incorrect number of arguments')
 
+    if options.files and not options.fold:
+        parser.error('--file can only be specified with --fold')
+
     if not options.unapplied:
         check_local_changes()
         check_conflicts()

             reply	other threads:[~2009-01-14 23:09 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-14 22:59 Catalin Marinas [this message]
2009-01-15  8:26 ` [StGit PATCH] Add --file option to pick Karl Hasselström

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090114225930.11098.2144.stgit@localhost.localdomain \
    --to=catalin.marinas@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=kha@treskal.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).