From: "Dave O'Neill" <dmo@roaringpenguin.com>
To: git@vger.kernel.org
Cc: "Dave O'Neill" <dmo@roaringpenguin.com>
Subject: [PATCH] Let git-svnimport clean up SVK commit messages.
Date: Wed, 20 Jun 2007 22:14:55 -0400 [thread overview]
Message-ID: <1182392095394-git-send-email-dmo@roaringpenguin.com> (raw)
SVK likes to begin all commit messages with a line of the format:
r12345@hostname: user | YYYY-MM-DD HH:MM:SS -ZZZZ
which makes the import desperately ugly in git. This adds a -k option to move
this extra SVK commit line to the end of the commit message, rather than
keeping it at the beginning.
---
Documentation/git-svnimport.txt | 6 +++++-
git-svnimport.perl | 18 +++++++++++++++---
2 files changed, 20 insertions(+), 4 deletions(-)
diff --git a/Documentation/git-svnimport.txt b/Documentation/git-svnimport.txt
index e97d15e..23a54b0 100644
--- a/Documentation/git-svnimport.txt
+++ b/Documentation/git-svnimport.txt
@@ -11,7 +11,7 @@ SYNOPSIS
--------
[verse]
'git-svnimport' [ -o <branch-for-HEAD> ] [ -h ] [ -v ] [ -d | -D ]
- [ -C <GIT_repository> ] [ -i ] [ -u ] [-l limit_rev]
+ [ -C <GIT_repository> ] [ -i ] [ -k ] [ -u ] [-l limit_rev]
[ -b branch_subdir ] [ -T trunk_subdir ] [ -t tag_subdir ]
[ -s start_chg ] [ -m ] [ -r ] [ -M regex ]
[ -I <ignorefile_name> ] [ -A <author_file> ]
@@ -68,6 +68,10 @@ When importing incrementally, you might need to edit the .git/svn2git file.
Prepend 'rX: ' to commit messages, where X is the imported
subversion revision.
+-k::
+ Remove SVK-style revision/commiter info from the top of commit
+ messages and move it to the bottom.
+
-I <ignorefile_name>::
Import the svn:ignore directory property to files with this
name in each directory. (The Subversion and GIT ignore
diff --git a/git-svnimport.perl b/git-svnimport.perl
index f459762..7076f41 100755
--- a/git-svnimport.perl
+++ b/git-svnimport.perl
@@ -32,20 +32,20 @@ $ENV{'TZ'}="UTC";
our($opt_h,$opt_o,$opt_v,$opt_u,$opt_C,$opt_i,$opt_m,$opt_M,$opt_t,$opt_T,
$opt_b,$opt_r,$opt_I,$opt_A,$opt_s,$opt_l,$opt_d,$opt_D,$opt_S,$opt_F,
- $opt_P,$opt_R);
+ $opt_P,$opt_R,$opt_k);
sub usage() {
print STDERR <<END;
Usage: ${\basename $0} # fetch/update GIT from SVN
[-o branch-for-HEAD] [-h] [-v] [-l max_rev] [-R repack_each_revs]
[-C GIT_repository] [-t tagname] [-T trunkname] [-b branchname]
- [-d|-D] [-i] [-u] [-r] [-I ignorefilename] [-s start_chg]
+ [-d|-D] [-i] [-k] [-u] [-r] [-I ignorefilename] [-s start_chg]
[-m] [-M regex] [-A author_file] [-S] [-F] [-P project_name] [SVN_URL]
END
exit(1);
}
-getopts("A:b:C:dDFhiI:l:mM:o:rs:t:T:SP:R:uv") or usage();
+getopts("A:b:C:dDFhiI:kl:mM:o:rs:t:T:SP:R:uv") or usage();
usage if $opt_h;
my $tag_name = $opt_t || "tags";
@@ -835,7 +835,19 @@ sub commit {
$pw->writer();
$pr->reader();
+
+ if ( $opt_k ) {
+ # Remove SVK cruft in commit message
+ my ($svk_info) = $message =~ s{(r\d+\@[^:]+:\s+\S+\s+\|\s+\d{4}-\d{2}-\d{2}\s+\d{2}:\d{2}:\d{2}\s[\+-]\d{4})\s*}{};
+ if( $svk_info ) {
+ # and stick it on the end so we don't lose it
+ $message .= "\n$svk_info"
+ }
+ }
+
+
$message =~ s/[\s\n]+\z//;
+
$message = "r$revision: $message" if $opt_r;
print $pw "$message\n"
--
1.5.2.2.239.g89630
next reply other threads:[~2007-06-21 2:31 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-06-21 2:14 Dave O'Neill [this message]
2007-06-21 3:19 ` [PATCH] Let git-svnimport clean up SVK commit messages Steven Grimm
2007-06-21 14:14 ` Dave O'Neill
2007-06-21 15:00 ` Jeffrey C. Ollie
2007-06-21 21:58 ` Dave O'Neill
2007-06-21 6:01 ` Sam Vilain
2007-06-21 14:22 ` Dave O'Neill
2007-06-21 20:51 ` [PATCH] Let git-svnimport and git-svn " Dave O'Neill
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=1182392095394-git-send-email-dmo@roaringpenguin.com \
--to=dmo@roaringpenguin.com \
--cc=git@vger.kernel.org \
/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).