From: Martin Langhoff <martin.langhoff@gmail.com>
To: GIT <git@vger.kernel.org>
Subject: Mergeback patch - (was: Switching heads and head vs branch after CVS import)
Date: Tue, 16 Aug 2005 08:50:04 +1200 [thread overview]
Message-ID: <46a038f90508151350675527e7@mail.gmail.com> (raw)
In-Reply-To: <20050815204511.B6D793300AD@ng.eduforge.org>
Just a work-in-progress sample. I've done a pretty successful import
of a small tree with this patch. It is showing the merges /almost/ in
the right place. The almost is due to bad cvs practices, and not this
code.
Definitely doable, though it'll never be "nice" -- CVS doesn't have
the right data for this. I want to make the regexes configurable, and
have a more decent way of extracting the parent sha. B
diff --git a/git-cvsimport-script b/git-cvsimport-script
--- a/git-cvsimport-script
+++ b/git-cvsimport-script
@@ -542,6 +542,24 @@ my $commit = sub {
my @par = ();
@par = ("-p",$parent) if $parent;
+
+ # detect additional branches
+ my @rx = ( qr/Merged from (\w+)/i , qr/merge of (\w+)/i );
+ foreach my $rx (@rx) {
+ if ($logmsg =~ $rx) {
+ my $parent = $1;
+ if ($parent eq 'HEAD') { $parent = 'origin'};
+ if ( -e "$git_dir/refs/heads/$parent") {
+ warn "grabbing $parent";
+ $parent = `cat $git_dir/refs/heads/$parent`;
+ chomp $parent;
+ warn "grabbed $parent";
+ push @par, '-p', $parent;
+ }
+ }
+ }
+ # %seen_branches
+
exec("env",
"GIT_AUTHOR_NAME=$author",
"GIT_AUTHOR_EMAIL=$author",
parent reply other threads:[~2005-08-15 20:50 UTC|newest]
Thread overview: expand[flat|nested] mbox.gz Atom feed
[parent not found: <20050815204511.B6D793300AD@ng.eduforge.org>]
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=46a038f90508151350675527e7@mail.gmail.com \
--to=martin.langhoff@gmail.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).