|
|
| File: [Development] / xfs-cmds / xfsmisc / Attic / git-make-xfs (download)
Revision 1.3, Fri Jun 23 06:10:34 2006 UTC (11 years, 4 months ago) by nathans.longdrop.melbourne.sgi.com
Update saved copy of my git send script. Merge of master-melb:xfs-cmds:26330a by kenmcd. |
#!/usr/bin/perl -w
# extract commits from a git repo, produce email body
#
use strict;
if ($#ARGV != 0) {
print STDERR "Usage: git-make-xfs </path/to/git-parent>\n";
exit 1;
}
my $parent_tree = $ARGV[0];
my $first_commit;
my $final_parent;
my $repeat_parent = 0;
my $changes;
open CHANGES, "git-changes-script -L $parent_tree |"
or die "git-changes-script";
while (<CHANGES>) {
if (/^commit (\S+)$/) {
$first_commit = $1 if !defined($first_commit);
$repeat_parent = 0;
} elsif (/^parent (\S+)$/) {
if ($repeat_parent) { # This was a Merge not a mod
$repeat_parent = 0;
$first_commit = undef;
} else {
$final_parent = $1;
$repeat_parent = 1;
}
} else {
$repeat_parent = 0;
}
$changes .= $_;
}
close CHANGES;
if (!defined($changes)) {
print STDERR "No differences.\n";
exit 0;
}
if (!defined($final_parent)) {
print STDERR "No final parent to merge.\n";
exit 0;
}
print STDERR "Completed: git-changes-script ...\n";
print STDERR $changes;
print STDERR "Starting: git-export $first_commit $final_parent\n";
print "Please pull from:\n";
print "\tgit://oss.sgi.com:8090/nathans/xfs-2.6.git\n";
print "\n";
print "This will update the following files:\n";
print "\n";
open DIFFSTAT, "git-export $first_commit $final_parent | diffstat -p1 |"
or die "git-export | diffstat";
while (<DIFFSTAT>) { print; }
close DIFFSTAT;
print "\n";
print "through these commits:\n";
print "\n";
print $changes;
print STDERR "Completed: git-export\n";