summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 36932ea)
raw | patch | inline | side by side (parent: 36932ea)
author | Martin Langhoff <martin@catalyst.net.nz> | |
Wed, 26 Apr 2006 00:26:16 +0000 (12:26 +1200) | ||
committer | Martin Langhoff <martin@catalyst.net.nz> | |
Wed, 26 Apr 2006 00:26:16 +0000 (12:26 +1200) |
Documentation/git-cvsexportcommit.txt | patch | blob | history | |
git-cvsexportcommit.perl | patch | blob | history |
index d30435a9e4c6ec9797110869c202aea2f8e257a1..56bd3e517d80e6542a3aa118984aee0fefec2ab7 100644 (file)
SYNOPSIS
--------
-'git-cvsexportcommmit' [-h] [-v] [-c] [-p] [PARENTCOMMIT] COMMITID
+'git-cvsexportcommmit' [-h] [-v] [-c] [-p] [-f] [-m msgprefix] [PARENTCOMMIT] COMMITID
DESCRIPTION
Be pedantic (paranoid) when applying patches. Invokes patch with
--fuzz=0
+-f::
+ Force the merge even if the files are not up to date.
+
+-m::
+ Prepend the commit message with the provided prefix.
+ Useful for patch series and the like.
+
-v::
Verbose.
index 7b3a3d323baeb2babd51f3a653e63a7a71aa48eb..f994443c6fa16257b9b6a44abfc999d2ed25e601 100755 (executable)
--- a/git-cvsexportcommit.perl
+++ b/git-cvsexportcommit.perl
die "GIT_DIR is not defined or is unreadable";
}
-our ($opt_h, $opt_p, $opt_v, $opt_c );
+our ($opt_h, $opt_p, $opt_v, $opt_c, $opt_f, $opt_m );
-getopts('hpvc');
+getopts('hpvcfm:');
$opt_h && usage();
$opt_v && print "Applying to CVS commit $commit from parent $parent\n";
# grab the commit message
-`git-cat-file commit $commit | sed -e '1,/^\$/d' > .msg`;
+open(MSG, ">.msg") or die "Cannot open .msg for writing";
+print MSG $opt_m;
+close MSG;
+
+`git-cat-file commit $commit | sed -e '1,/^\$/d' >> .msg`;
$? && die "Error extracting the commit message";
my (@afiles, @dfiles, @mfiles);
my @files = safe_pipe_capture('git-diff-tree', '-r', $parent, $commit);
-print @files;
+#print @files;
$? && die "Error in git-diff-tree";
foreach my $f (@files) {
chomp $f;
if (@status > 1) { warn 'Strange! cvs status returned more than one line?'};
unless ($status[0] =~ m/Status: Unknown$/) {
$dirty = 1;
- warn "File $f is already known in your CVS checkout!\n";
+ warn "File $f is already known in your CVS checkout -- perhaps it has been added by another user. Or this may indicate that it exists on a different branch. If this is the case, use -f to force the merge.\n";
}
}
foreach my $f (@mfiles, @dfiles) {
}
}
if ($dirty) {
- die "Exiting: your CVS tree is not clean for this merge.";
+ if ($opt_f) { warn "The tree is not clean -- forced merge\n";
+ $dirty = 0;
+ } else {
+ die "Exiting: your CVS tree is not clean for this merge.";
+ }
}
###
}
sub usage {
print STDERR <<END;
-Usage: GIT_DIR=/path/to/.git ${\basename $0} [-h] [-p] [-v] [-c] [ parent ] commit
+Usage: GIT_DIR=/path/to/.git ${\basename $0} [-h] [-p] [-v] [-c] [-f] [-m msgprefix] [ parent ] commit
END
exit(1);
}