From: Yann Dirson Date: Mon, 20 Aug 2007 21:35:59 +0000 (+0100) Subject: Add -O flag to stg-fold-files-from. X-Git-Tag: v0.14.3~169 X-Git-Url: https://git.distorted.org.uk/~mdw/stgit/commitdiff_plain/d62357172398da1d389406d234dca3ff477083e8?ds=sidebyside Add -O flag to stg-fold-files-from. Signed-off-by: Yann Dirson --- diff --git a/contrib/stg-fold-files-from b/contrib/stg-fold-files-from index 53d3d02..806a157 100755 --- a/contrib/stg-fold-files-from +++ b/contrib/stg-fold-files-from @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash set -e # stg-fold-files-from - picks changes to one file from another patch. @@ -6,8 +6,9 @@ set -e # of hunks from the file, using the -# flag to filterdiff. # Use together with "filterdiff --annotate" in your diff pager, to # identify hunk numbers easily. +# Use "-O -U" to get finer hunk granularity for -#. -# usage: stg-fold-files-from [-#[-][,]...] +# usage: stg-fold-files-from [-O ] [-#[-][,]...] # Copyright (c) 2006-2007 Yann Dirson # Subject to the GNU GPL, version 2. @@ -18,14 +19,17 @@ shift filtercmd=cat hunks= foldflags= +showflags=() while [ "$#" -gt 0 ]; do case "$1" in - -\#*) hunks="$1"; shift ;; - -t) foldflags="-t"; shift ;; + -\#*) hunks="$1" ;; + -t) foldflags="-t" ;; + -O) showflags+=(-O "$2"); shift ;; -*) { echo >&2 "unknown flag '$1'"; exit 1; } ;; *) break ;; esac + shift done [ "$#" = 1 ] || { echo >&2 "supports one file only"; exit 1; } -stg show "$PATCH" | filterdiff -p1 $hunks -i "$1" | stg fold $foldflags +stg show "${showflags[@]}" "$PATCH" | filterdiff -p1 $hunks -i "$1" | stg fold $foldflags