'' => "\e[m",
'outstanding' => "\e[1;33m",
'unmerge' => "\e[1;31m",
+ 'reject' => "\e[31m",
+ 'unreject' => "\e[31m",
'merge' => "\e[32m",
'base' => "\e[1;34m",
'previous' => "\e[34m",
(
'' => "color: black; background-color: black",
'outstanding' => "color: black; background-color: yellow",
- 'unmerge' => "color: black; background-color: red",
+ 'unmerge' => "color: black; background-color: lightred",
+ 'reject' => "color: black; background-color: red",
+ 'unreject' => "color: black; background-color: red",
'merge' => "color: black; background-color: green",
'base' => "color: black; background-color: lightblue",
'previous' => "color: black; background-color: blue",
(
'outstanding' => "OUTSTANDING",
'unmerge' => "UNMERGED",
+ 'reject' => "REJECTED",
+ 'unreject' => "UNREJECTED",
'merge' => "MERGED",
'base' => "BASE",
'previous' => "PREVIOUS",
}
}
+sub reject_commit($)
+{
+ # reject == merge but skip
+ my ($r) = @_;
+ my $cmsg = "";
+ my $author = "";
+ my $email = "";
+ my $date = "";
+ if($do_commit)
+ {
+ $logcache = undef;
+ my $msg = backtick 'git', 'log', '-1', '--pretty=fuller', $r
+ or die "git-log: $!";
+ for(split /\n/, $msg)
+ {
+ if(/^Author:\s*(.*) <(.*)>/)
+ {
+ $author = $1;
+ $email = $2;
+ }
+ elsif(/^AuthorDate:\s*(.*)/)
+ {
+ $date = $1;
+ }
+ elsif(/^ (.*)/)
+ {
+ $cmsg .= "$1\n";
+ }
+ }
+ open my $fh, '>', '.commitmsg'
+ or die ">.commitmsg: $!";
+ print $fh "$cmsg" . "::stable-branch::reject=$r\n"
+ or die ">.commitmsg: $!";
+ close $fh
+ or die ">.commitmsg: $!";
+ }
+ local $ENV{GIT_AUTHOR_NAME} = $author;
+ local $ENV{GIT_AUTHOR_EMAIL} = $email;
+ local $ENV{GIT_AUTHOR_DATE} = $date;
+ if($do_commit)
+ {
+ run 'git', 'commit', '--allow-empty', '-F', '.commitmsg'
+ or die "git-commit: $!";
+ }
+}
+
+sub unreject_commit($)
+{
+ # reject == merge but skip
+ my ($r) = @_;
+ my $cmsg = "";
+ my $author = "";
+ my $email = "";
+ my $date = "";
+ if($do_commit)
+ {
+ $logcache = undef;
+ my $msg = backtick 'git', 'log', '-1', '--pretty=fuller', $r
+ or die "git-log: $!";
+ for(split /\n/, $msg)
+ {
+ if(/^Author:\s*(.*) <(.*)>/)
+ {
+ $author = $1;
+ $email = $2;
+ }
+ elsif(/^AuthorDate:\s*(.*)/)
+ {
+ $date = $1;
+ }
+ elsif(/^ (.*)/)
+ {
+ $cmsg .= "$1\n";
+ }
+ }
+ open my $fh, '>', '.commitmsg'
+ or die ">.commitmsg: $!";
+ print $fh "$cmsg" . "::stable-branch::unreject=$r\n"
+ or die ">.commitmsg: $!";
+ close $fh
+ or die ">.commitmsg: $!";
+ }
+ local $ENV{GIT_AUTHOR_NAME} = $author;
+ local $ENV{GIT_AUTHOR_EMAIL} = $email;
+ local $ENV{GIT_AUTHOR_DATE} = $date;
+ if($do_commit)
+ {
+ run 'git', 'commit', '--allow-empty', '-F', '.commitmsg'
+ or die "git-commit: $!";
+ }
+}
+
sub merge_commit($)
{
my ($r) = @_;
for(0..$newbase_id)
{
- if(!$log->{bitmap}[$_])
+ if($log->{bitmap}[$_] < 0)
+ {
+ unshift @rlog, ['reject', $log->{order_a}[$_]];
+ }
+ elsif(!$log->{bitmap}[$_])
{
unshift @rlog, ['unmerge', $log->{order_a}[$_]];
}
for($newbase_id+1 .. @{$log->{order_a}}-1)
{
- if($log->{bitmap}[$_])
+ if($log->{bitmap}[$_] > 0)
{
push @rlog, ['merge', $log->{order_a}[$_]];
}
+ elsif($log->{bitmap}[$_] < 0)
+ {
+ push @rlog, ['reject', $log->{order_a}[$_]];
+ }
else
{
push @outstanding, ['outstanding', $log->{order_a}[$_]];
{
push @logdata, ['merge', $1];
}
+ elsif($data =~ /::stable-branch::reject=(\S+)/)
+ {
+ push @logdata, ['reject', $1];
+ }
+ elsif($data =~ /::stable-branch::unreject=(\S+)/)
+ {
+ push @logdata, ['unreject', $1];
+ }
elsif($data =~ /::stable-branch::reset=(\S+)/)
{
@logdata = ();
{
$bitmap[$history{$data}] = 0;
}
+ elsif($cmd eq 'reject')
+ {
+ $bitmap[$history{$data}] = -1;
+ }
+ elsif($cmd eq 'unreject')
+ {
+ $bitmap[$history{$data}] = 0;
+ }
elsif($cmd eq 'rebase')
{
# the bitmap is fine, but generate a new log from the bitmap
{
my $l = parse_log();
die "PEBKAC: invalid revision number, cannot reset"
- unless defined $l->{order_h}{$r} and not $l->{bitmap}[$l->{order_h}{$r}];
+ unless defined $l->{order_h}{$r} and $l->{bitmap}[$l->{order_h}{$r}] == 0;
die "PEBKAC: not initialized"
unless defined $l->{base};
}
{
my $l = parse_log();
die "PEBKAC: invalid revision number, cannot reset"
- unless defined $l->{order_h}{$r} and $l->{bitmap}[$l->{order_h}{$r}];
+ unless defined $l->{order_h}{$r} and $l->{bitmap}[$l->{order_h}{$r}] > 0;
die "PEBKAC: not initialized"
unless defined $l->{base};
}
unmerge_commit $r;
}
+ elsif($cmd eq 'reject')
+ {
+ if($pebkac)
+ {
+ my $l = parse_log();
+ die "PEBKAC: invalid revision number, cannot reset"
+ unless defined $l->{order_h}{$r} and $l->{bitmap}[$l->{order_h}{$r}] == 0;
+ die "PEBKAC: not initialized"
+ unless defined $l->{base};
+ }
+ reject_commit $r;
+ }
+ elsif($cmd eq 'unreject')
+ {
+ if($pebkac)
+ {
+ my $l = parse_log();
+ die "PEBKAC: invalid revision number, cannot reset"
+ unless defined $l->{order_h}{$r} and $l->{bitmap}[$l->{order_h}{$r}] < 0;
+ die "PEBKAC: not initialized"
+ unless defined $l->{base};
+ }
+ unreject_commit $r;
+ }
elsif($cmd eq 'outstanding')
{
}