debian/ 0000755 0000000 0000000 00000000000 12203063746 007171 5 ustar debian/clean 0000644 0000000 0000000 00000000013 12203063746 010170 0 ustar debian/*.1
debian/pod2man.mk 0000644 0000000 0000000 00000003321 12203063746 011061 0 ustar # pod2man.mk -- Makefile portion to convert *.pod files to manual pages
#
# Copyright information
#
# Copyright (C) 2008-2013 Jari Aalto
#
# License
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
#
# Description
#
# Convert *.pod files to manual pages. Write this to 'install'
# target:
#
# install: build $(MANPAGE)
ifneq (,)
This makefile requires GNU Make.
endif
# This variable *must* be set when calling
PACKAGE ?= package
RELEASE ?= $(PACKAGE)
# Optional variables to set
MANSECT ?= 1
PODCENTER ?= $$(date "+%Y-%m-%d")
# Directories
MANSRC =
MANDEST = $(MANSRC)
MANPOD = $(MANSRC)$(PACKAGE).$(MANSECT).pod
MANPAGE = $(MANDEST)$(PACKAGE).$(MANSECT)
POD2MAN = pod2man
POD2MAN_FLAGS = --utf8
makeman: $(MANPAGE)
$(MANPAGE): $(MANPOD)
# make target - create manual page from a *.pod page
podchecker $(MANPOD)
LC_ALL=C $(POD2MAN) $(POD2MAN_FLAGS) \
--center="$(PODCENTER)" \
--name="$(PACKAGE)" \
--section="$(MANSECT)" \
--release="$(RELEASE)" \
$(MANPOD) \
> $(MANPAGE) && \
rm -f pod*.tmp
# End of of Makefile part
debian/watch 0000644 0000000 0000000 00000000153 12203063746 010221 0 ustar version=3
# There is no version "tag". Just plain code. See debian/copyright and
# Download code manually.
debian/rules 0000755 0000000 0000000 00000000411 12203063746 010245 0 ustar #!/usr/bin/make -f
PACKAGE = splitpatch
man:
$(MAKE) -C debian -f pod2man.mk PACKAGE=$(PACKAGE) makeman
override_dh_installman: man
dh_installman
override_dh_auto_install:
install -D -m 755 *.rb debian/$(PACKAGE)/usr/bin/splitpatch
%:
dh $@
# End of file
debian/changelog 0000644 0000000 0000000 00000000255 12203063746 011045 0 ustar splitpatch (0.0+20130626+gitbd6a83d-1) unstable; urgency=low
* Initial release (Closes: #711935).
-- Jari Aalto Sun, 11 Aug 2013 10:56:37 +0300
debian/patches/ 0000755 0000000 0000000 00000000000 12203063746 010620 5 ustar debian/patches/10-zero-filename.patch 0000644 0000000 0000000 00000004225 12203063746 014617 0 ustar From: Jari Aalto
Subject: Use 3 digit NNN in output files
Use dash(-), not dot(.) in file names. Use zero based file names.
Format: FILENAME-NNN.patch for hunks and
FILENAME.patch-NNN for regular files (if file already exists).
---
splitpatch.rb | 18 ++++++++++--------
1 file changed, 10 insertions(+), 8 deletions(-)
--- a/splitpatch.rb
+++ b/splitpatch.rb
@@ -1,4 +1,4 @@
-#!/usr/local/bin/ruby
+#!/usr/bin/env ruby
#
# splitpatch is a simple script to split a patch up into multiple patch files.
# if the --hunks option is provided on the command line, each hunk gets its
@@ -51,10 +51,11 @@
if File.exists?(filename)
puts "File #{filename} already exists. Renaming patch."
appendix = 0
- while File.exists?("#{filename}.#{appendix}")
+ zero = appendix.to_s.rjust(3, '0')
+ while File.exists?("#{filename}-#{zero}")
appendix += 1
end
- filename << ".#{appendix}"
+ filename << "-#{zero}"
end
outfile = open(filename, "w")
outfile.write(line)
@@ -91,14 +92,16 @@
if (outfile)
outfile.close_write
end
- hunkfilename = "#{filename}.#{counter}.patch"
+ zero = counter.to_s.rjust(3, '0')
+ hunkfilename = "#{filename}-#{zero}.patch"
if File.exists?(hunkfilename)
puts "File #{hunkfilename} already exists. Renaming patch."
appendix = 0
- while File.exists?("#{hunkfilename}.#{appendix}")
+ zero = appendix.to_s.rjust(3, '0')
+ while File.exists?("#{hunkfilename}-#{zero}")
appendix += 1
end
- hunkfilename << ".#{appendix}"
+ hunkfilename << "-#{zero}"
end
outfile = open(hunkfilename, "w")
counter += 1
@@ -141,5 +144,4 @@
end
end
-
-
+# End of file
debian/patches/series 0000644 0000000 0000000 00000000050 12203063746 012030 0 ustar 10-zero-filename.patch
20-options.patch
debian/patches/20-options.patch 0000644 0000000 0000000 00000005001 12203063746 013547 0 ustar From: Jari Aalto
Subject: Add options --help, --version and short option -H for hunks
---
splitpatch.rb | 61 +++++++++++++++++++++++++++++++++++++++++++++++-----------
1 file changed, 50 insertions(+), 11 deletions(-)
--- a/splitpatch.rb
+++ b/splitpatch.rb
@@ -21,6 +21,12 @@
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
#
+
+PROGRAM = "splitpatch"
+VERSION = 0.0
+LICENSE = "GPL-2+" # See official acronyms: https://spdx.org/licenses/
+AUTHOR = "Peter Hutterer "
+
class Splitter
def initialize(file)
@filename = file
@@ -118,29 +124,62 @@
end
+def help
+ puts < 2
- puts "Wrong parameter. Usage: splitpatch.rb [--hunks] "
- exit 1
-elsif ARGV[0] == "--help"
- puts "splitpatch splits a patch that is supposed to patch multiple files"
- puts "into a set of patches."
- puts "Currently splits unified diff patches."
- puts "If the --hunk option is given, a new file is created for each hunk."
+ puts "ERROR: missing argument. See --help."
exit 1
else
- s = Splitter.new(ARGV[-1])
+ opt = ARGV[0]
+ if /^-h$|--help/.match(opt)
+ help
+ exit 0
+ elsif /^-H$|--hunks?/.match(opt)
+ hunk = 1
+ elsif /^-V$|--version/.match(opt)
+ version
+ exit 0
+ elsif /^-/.match(opt)
+ puts "ERROR: Unknonw option: #{opt}. See --help."
+ exit 1
+ end
+ file = ARGV[-1]
+ s = Splitter.new(file)
if s.validFile?
- if ARGV[0] == "--hunks"
+ if hunk
s.splitByHunk
else
s.splitByFile
end
else
- puts "File does not exist or is not readable"
+ puts "File does not exist or is not readable: #{file}"
end
end
debian/docs 0000644 0000000 0000000 00000000012 12203063746 010035 0 ustar README.md
debian/source/ 0000755 0000000 0000000 00000000000 12203063746 010471 5 ustar debian/source/format 0000644 0000000 0000000 00000000014 12203063746 011677 0 ustar 3.0 (quilt)
debian/compat 0000644 0000000 0000000 00000000002 12203063746 010367 0 ustar 9
debian/copyright 0000644 0000000 0000000 00000002405 12203063746 011125 0 ustar Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0
Upstream-Name: splitpatch
Upstream-Contact:
Source: http://www.clearchain.com/blog/posts/splitting-a-patch
X-Upstream-Vcs: https://github.com/benjsc/splitpatch
Comment:
The maintainer of homepage and Git repo is
Files: *
Copyright:
2007 Peter Hutterer
License: GPL-2+
Files: debian/*
Copyright:
2013 Jari Aalto
License: GPL-2+
License: GPL-2+
This package is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
.
This package is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
.
You should have received a copy of the GNU General Public License
along with this program. If not, see .
.
On Debian systems, the complete text of the GNU General
Public License can be found in "/usr/share/common-licenses/GPL-2".
debian/splitpatch.1.pod 0000644 0000000 0000000 00000006657 12203063746 012225 0 ustar # Copyright
#
# Copyright (C) 2013 Jari Aalto
#
# License
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
#
# Description
#
# To learn what TOP LEVEL sections to use in manual page,
# see POSIX/Susv standard about "Utility Description Defaults" at
# http://www.opengroup.org/onlinepubs/009695399/utilities/xcu_chap01.html#tag_01_11
#
# This manual page in Perl POD format. Read more at
# http://perldoc.perl.org/perlpod.html or run command:
#
# perldoc perlpod | less
#
# To check the syntax:
#
# podchecker *.pod
#
# To create manual:
#
# pod2man PROGRAM.N.pod > PROGRAM.N
=pod
=head1 NAME
splitpatch - split a patch up into files or hunks
=head1 SYNOPSIS
splitpatch [options]
=head1 DESCRIPTION
Divide a patch or diff file into pieces. The split can made by file
or by hunk basis. This makes is possible to separate changes that
might not be desirable, or assemble a patch into more coherent set
of changes.
The hunk option makes it possible to compare similar patches on a
hunk-by-hunk basis using a tool like interdiff(1) from the patchutils package.
=head1 OPTIONS
=over 4
=item B<-H, --hunk, --hunks>
Split patch by hunks instead of the default: by file.
=item B<-h, --help>
Display help and exit
=item B<-V, --version>
Output version information and exit.
=back
=head1 EXAMPLES
Have you ever been working on code, gone off on a side tangent and
then realized you don't have a patch for the original issue you
set out to address? When you run C or some other diff command,
you discover that you have made multiple sets of changes; some
you want to submit, others you don't. What you really want to do is
break those changes apart and apply only the ones you want. This is
where splitpatch comes into play, breaking up the patch by source file:
splitpatch changes.patch
Or to split the patch file into individual hunks which can later be
applied using the patch(1) command:
splitpatch --hunks changes.patch
=head1 ENVIRONMENT
None.
=head1 FILES
The B<--hunk> option writes sequentially numbered files in the current
directory named for the source file to be patched followed by the
sequence number: C<*-NNN.patch>.
Otherwise, the split patch files are named by the source file being
patched.
=head1 STANDARDS
None.
=head1 AVAILABILITY
https://github.com/benjsc/splitpatch
=head1 SEE ALSO
dehtmldiff(1)
editdiff(1)
filterdiff(1)
fixcvsdiff(1)
flipdiff(1)
grepdiff(1)
interdiff(1)
lsdiff(1)
patch(1)
recountdiff(1)
rediff(1)
splitdiff(1)
unwrapdiff(1)
wiggle(1)
=head1 AUTHORS
Program was written by Peter Hutterer .
This manual page was written by Jari Aalto .
Released under license GNU GPL version 2 or (at your option) any later
version. For more information about the license, visit
.
=cut
debian/manpages 0000644 0000000 0000000 00000000013 12203063746 010701 0 ustar debian/*.1
debian/control 0000644 0000000 0000000 00000001703 12203063746 010575 0 ustar Source: splitpatch
Section: text
Priority: optional
Maintainer: Jari Aalto
Build-Depends: debhelper (>= 9)
Standards-Version: 3.9.4
Vcs-Browser: http://anonscm.debian.org/gitweb/?p=collab-maint/debian.git
Vcs-Git: git://anonscm.debian.org/collab-maint/debian.git
Homepage: http://www.clearchain.com/blog/posts/splitting-a-patch
Package: splitpatch
Architecture: all
Depends: ${misc:Depends}, ruby
Description: split the patch up into files or hunks
Divide a patch or diff file into pieces. The split can made by file
or by hunk basis. This makes is possible to separate changes that
might not be desireable or assemble the patch into more coherent set
of changes.
.
The hunk option opens up possibility to compare similar patches
hunk-by-hunk using tool like interdiff(1) from patchutils package.
Operating on hunk level also gives more control, smilar to Git, to
selectively shelve in changes e.g. to Version Control repository.