Your message dated Sun, 05 Oct 2014 12:04:06 +0000
with message-id <[email protected]>
and subject line Bug#662726: fixed in gitpkg 0.25
has caused the Debian Bug report #662726,
regarding gitpkg: proposed new patch-export script
to be marked as done.
This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.
(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)
--
662726: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=662726
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Package: gitpkg
Version: 0.21
Severity: wishlist
Hi Ron;
Here is the script we discussed on IRC to allow selective export of
git commits as quilt patches, either interactively or as part of a git
hook. The advantage over the existing scheme is that this supports
patches that are already merged into to the packaging/integration
branch. Probably it is a bit rough around the edges (e.g. the man
page is a bit user-hostile), but hopefully we can use this bug to
track discussion and whip it into shape.
David
-- System Information:
Debian Release: wheezy/sid
APT prefers testing
APT policy: (900, 'testing')
Architecture: amd64 (x86_64)
Kernel: Linux 3.2.0-1-amd64 (SMP w/8 CPU cores)
Locale: LANG=en_CA.UTF-8, LC_CTYPE=en_CA.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Versions of packages gitpkg depends on:
ii dpkg-dev 1.16.1.2
ii git 1:1.7.9.1-1
gitpkg recommends no packages.
Versions of packages gitpkg suggests:
ii devscripts 2.11.4
-- no debconf information
>From 78ed58fee095218ed7683ac121177c66ae9c0a57 Mon Sep 17 00:00:00 2001
From: David Bremner <[email protected]>
Date: Mon, 5 Mar 2012 12:17:46 -0400
Subject: [PATCH] git-debpatch: select commits to be exported as quilt patches
This script allows the user to mark commits for export as
quilt-patches in debian/patches. gitpkg support is provided via
hooks/quilt-patches-deb-export-hook.
---
git-debpatch | 127 +++++++++++++++++++++++++++++++++++
git-debpatch.1 | 83 +++++++++++++++++++++++
gitpkg.1 | 3 +-
hooks/quilt-patches-deb-export-hook | 3 +
4 files changed, 215 insertions(+), 1 deletions(-)
create mode 100755 git-debpatch
create mode 100644 git-debpatch.1
diff --git a/git-debpatch b/git-debpatch
new file mode 100755
index 0000000..6a20fc1
--- /dev/null
+++ b/git-debpatch
@@ -0,0 +1,127 @@
+#!/bin/bash
+
+GN="git notes --ref debpatch"
+patch_dir=debian/patches
+
+# get_field ref Field
+#
+function get_field() {
+ ${GN} show $1 2>/dev/null | sed -n "s/^$2: \(.*\)$/\1/p"
+}
+
+# set_field ref Field Val
+function set_field() {
+ other_fields=$(${GN} show $1 2>/dev/null | grep -v "^$2: ")
+ printf "$2: $3\n$other_fields" | ${GN} add -f -F- $1 2>/dev/null
+}
+
+# remove_field ref Field
+function remove_field() {
+ other_fields=$(${GN} show $1 2>/dev/null | grep -v "^$2: ")
+ if [ -n "$other_fields" ] ; then
+ printf "$other_fields" | ${GN} add -f -F- 1>/dev/null
+ else
+ $GN remove $1 2>/dev/null
+ fi
+}
+
+function is_exportable() {
+ [ $(get_field $1 Export)x = "truex" ]
+}
+
+function export_one_patch() {
+ if [ -f $patch_dir/series ]; then
+ count=$(wc -l "$patch_dir/series" | cut -f1 -d' ')
+ else
+ mkdir -p "$patch_dir" || exit 1
+ echo "# exported from git by git-debpatch" > "$patch_dir/series"
+ count=1
+ fi
+
+ name=$(git format-patch --start-number $count -1 -o "$patch_dir" $1)
+ echo "$name" | sed -e "s,$patch_dir/,,g" -e 's, ,\n,g' >> "$patch_dir/series"
+}
+
+function print_status() {
+ if is_exportable $1; then
+ printf "E\t"
+ else
+ printf "\t"
+ fi
+ printf "%7.7s\t" $1
+ printf "%0.30s" "$(git --no-pager log --format="%s" -1 $1)"
+ printf "\t%s\n" $(get_field $1 Forwarded)
+}
+
+function do_one_commit() {
+ case $1 in
+ export)
+ set_field $2 Export true
+ ;;
+ noexport)
+ remove_field $2 Export
+ ;;
+ forwarded)
+ set_field $2 Forwarded $3
+ ;;
+ noforwarded)
+ remove_field $2 Forwarded
+ ;;
+ status)
+ print_status $2
+ ;;
+ toquilt)
+ if is_exportable $2; then
+ export_one_patch $2
+ fi
+ ;;
+ *)
+ echo "Unknown operation $1"
+ exit 1;
+ esac
+}
+
+
+case $1 in
+ fetch)
+ remote=${2-origin}
+ git fetch $remote refs/notes/debpatch:refs/notes/remotes/$remote/debpatch
+ exit 0;
+ ;;
+ merge)
+ remote=${2-origin}
+ ${GN} merge --strategy=cat_sort_uniq refs/notes/remotes/$remote/debpatch
+ exit 0;
+ ;;
+ pull)
+ git debpatch fetch $2 && git debpatch merge $2
+ exit $?
+ ;;
+ push)
+ remote=${2-origin}
+ git push $remote refs/notes/debpatch:refs/notes/debpatch
+ exit 0;
+ ;;
+ status|export|noexport|toquilt|forwarded)
+ if [ -z $2 ]; then
+ echo "$1 needs a ref or a range"
+ exit 1
+ fi
+ ;;
+ *)
+ echo "Unknown operation $1"
+ exit 1;
+esac
+
+case $(git rev-parse $2 | wc -l) in
+ 1)
+ do_one_commit $1 $2 $3
+ ;;
+ 2)
+ git rev-list --ancestry-path --reverse $2 | \
+ while read hash ; do do_one_commit $1 $hash $3; done
+ ;;
+ *)
+ echo "Internal error."
+ exit 1;
+esac
diff --git a/git-debpatch.1 b/git-debpatch.1
new file mode 100644
index 0000000..5af4af3
--- /dev/null
+++ b/git-debpatch.1
@@ -0,0 +1,83 @@
+.\" Hey, EMACS: -*- nroff -*-
+.\" First parameter, NAME, should be all caps
+.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
+.\" other parameters are allowed: see man(7), man(1)
+.TH GIT-DEBPATCH 1 "March 5, 2012"
+.\" Please adjust this date whenever revising the manpage.
+.\"
+.\" Some roff macros, for reference:
+.\" .nh disable hyphenation
+.\" .hy enable hyphenation
+.\" .ad l left justify
+.\" .ad b justify to both left and right margins
+.\" .nf disable filling
+.\" .fi enable filling
+.\" .br insert line break
+.\" .sp <n> insert n+1 empty lines
+.\" for manpage-specific macros, see man(7)
+.SH NAME
+git\-debpatch \- annotate and optionally export commits
+.SH SYNOPSIS
+.B git\-debpatch
+.RI [ command ] " ref-or-range " [ params ]
+
+.SH DESCRIPTION
+This program uses the \fBgit-notes\fP(1) facility to track certain
+metadata about git commits, and optionally export them as quilt patches.
+
+.SH COMMIT SYNTAX
+
+In the following, remote is a git remote, and ref-or-range refers to
+either to a single git ref (hash, branch, tag), or ref1..ref2 In the
+latter case, this refers to all commits on the "ancestor path" from
+ref2 to ref1, not including ref1. See the \-\-ancestor-path option,
+\fBgit-rev-list\fP(1).
+
+.SH COMMANDS
+
+
+The following commands are available:
+
+.TP
+.BR fetch " [remote]"
+Fetch debpatch specific notes from remote (default origin)
+
+.TP
+.BR merge " [remote]"
+Merge debpatch specific notes from remote (default origin).
+m
+.TP
+.BR pull " [remote]"
+Fetch and then merge.
+
+.TP
+.BR export " ref-or-range"
+Mark the given commit or range of commits to be exported.
+
+.TP
+.BR noexport " ref-or-range"
+Mark the given commit or range of commits \fBnot\fP to be exported.
+
+.TP
+.BR forwarded " ref-or-range " dest
+Mark the given commit or range of commits as forwarded to dest
+
+.TP
+.BR noforwarded " ref-or-range"
+Remove any forwarding annotation
+
+.TP
+.BR toquilt " ref-or-range"
+Export the any marked patches in the range to debian/patches. If
+debian/patches/series exists, new patches are appended.
+
+.TP
+.BR status " ref-or-range"
+Print out a one line summary for each commit, showing export-status,
+hash, subject, forwarded status, separated by tabs
+
+.SH SEE ALSO
+.BR gitpkg (1),
+.BR git (1)
+.SH AUTHOR
+git-debpatch was written by David Bremner <[email protected]>.
diff --git a/gitpkg.1 b/gitpkg.1
index 1ba10e1..6e0b7cd 100644
--- a/gitpkg.1
+++ b/gitpkg.1
@@ -515,7 +515,8 @@ most cases. For example:
.fi
.hy
-
+If the range of commits is prefixed with :debpatch:, then it will be passed to
+\fBgit-debpatch\fP(1) for export, rather than \fBgit-format-patch\fP.
.SS Hook Library Helpers
These are even more trivial snippets, for operations which may be shared by
diff --git a/hooks/quilt-patches-deb-export-hook b/hooks/quilt-patches-deb-export-hook
index 98b2aa7..b158779 100644
--- a/hooks/quilt-patches-deb-export-hook
+++ b/hooks/quilt-patches-deb-export-hook
@@ -64,6 +64,9 @@ do_patches (){
case $line in
\#*)
;;
+ :debpatch:*)
+ GIT_DIR=$REPO_DIR/.git git debpatch toquilt ${line//:debpatch:/}
+ ;;
*)
count=$(wc -l "$patch_dir/series" | cut -f1 -d' ')
if PATCHES="$(git --git-dir "$REPO_DIR/.git" format-patch --start-number $count -N -o "$patch_dir" "$line")"; then
--
1.7.9.1
--- End Message ---
--- Begin Message ---
Source: gitpkg
Source-Version: 0.25
We believe that the bug you reported is fixed in the latest version of
gitpkg, which is due to be installed in the Debian FTP archive.
A summary of the changes between this version and the previous one is
attached.
Thank you for reporting the bug, which will now be closed. If you
have further comments please address them to [email protected],
and the maintainer will reopen the bug report if appropriate.
Debian distribution maintenance software
pp.
Ron Lee <[email protected]> (supplier of updated gitpkg package)
(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing [email protected])
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Format: 1.8
Date: Sun, 05 Oct 2014 21:57:17 +1030
Source: gitpkg
Binary: gitpkg
Architecture: source all
Version: 0.25
Distribution: unstable
Urgency: medium
Maintainer: Ron Lee <[email protected]>
Changed-By: Ron Lee <[email protected]>
Description:
gitpkg - tools for maintaining Debian packages with git
Closes: 662726
Changes:
gitpkg (0.25) unstable; urgency=medium
.
* Introduce a new command 'git-debcherry' and an export hook to use it
'debcherry-deb-export-hook'. This exports a quilt patch series for
the differences between 'ref' and 'origref' by analysing the changes
in the repository to files outside the debian directory. It allows
a much more natural workflow of pushing proper patches to git that
upstream can cherry-pick, and automatically removes them from your
quilt patch series when they do. Many, many thanks to David Bremner
for the many, many hours he spent patiently writing, and testing,
and rewriting, and refining this until I stopped finding things to
whine about and saying "wait, but what if we ...". It's time to see
if others can find a way to surprise us with it now. Closes: #662726
Checksums-Sha1:
d5e2e49886f4cef3026d602af2445bf88a193b1a 819 gitpkg_0.25.dsc
4f62c0a70ea4333ad11a3152c70718a77b894de8 41141 gitpkg_0.25.tar.gz
d87e337d51609fd38851688e3c502e858843b900 42070 gitpkg_0.25_all.deb
Checksums-Sha256:
8fb9ad9b55df3488bd7d33afb20e2b94ae5ee684270f2a6e3773b2f881c68874 819
gitpkg_0.25.dsc
63f00b13f5ac412548727457081c4b1b9d4671efb254e97945dc22bd97b9988f 41141
gitpkg_0.25.tar.gz
1792fb431e5c4217a94a604229564ff41303cfdf21e0496d3b68397394894167 42070
gitpkg_0.25_all.deb
Files:
a42e4291f83ab6cc5a9f9696543dffb7 42070 vcs optional gitpkg_0.25_all.deb
2034bc455f3975fa480abfc60506e25e 819 vcs optional gitpkg_0.25.dsc
df589c0080153a9d63eda0c756259470 41141 vcs optional gitpkg_0.25.tar.gz
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2
iEYEARECAAYFAlQxMMsACgkQp4BCHGgCHOTOhACeIQJSRgjOkqNP8vFbqOYEcrAE
EYIAn1+lscWkDQxYGVdyCs+neoQe1coG
=/j0n
-----END PGP SIGNATURE-----
--- End Message ---