384
}
385
my $last_rev;
386
my ($linear_refs, $parents) = linearize_history($gs, \@refs);
387
+ if ($_no_rebase && scalar(@$linear_refs) > 1) {
388
+ warn "Attempting to commit more than one change while ",
389
+ "--no-rebase is enabled.\n",
390
+ "If these changes depend on each other, re-running ",
391
+ "without --no-rebase will be required."
392
+ }
393
foreach my $d (@$linear_refs) {
394
unless (defined $last_rev) {
395
(undef, $last_rev, undef) = cmt_metadata("$d~1");
401
if ($_dry_run) {
402
print "diff-tree $d~1 $d\n";
403
} else {
404
+ my $cmt_rev;
405
my %ed_opts = ( r => $last_rev,
406
log => get_commit_entry($d)->{log},
407
ra => Git::SVN::Ra->new($gs->full_url),
409
tree_b => $d,
410
editor_cb => sub {
411
print "Committed r$_[0]\n";
405
- $last_rev = $_[0]; },
412
+ $cmt_rev = $_[0];
413
+ },
414
svn_path => '');
415
if (!SVN::Git::Editor->new(\%ed_opts)->apply_diff) {
416
print "No changes\n$d~1 == $d\n";
417
} elsif ($parents->{$d} && @{$parents->{$d}}) {
410
- $gs->{inject_parents_dcommit}->{$last_rev} =
418
+ $gs->{inject_parents_dcommit}->{$cmt_rev} =
419
$parents->{$d};
420
}
421
+ $_fetch_all ? $gs->fetch_all : $gs->fetch;
422
+ next if $_no_rebase;
423
+
424
+ # we always want to rebase against the current HEAD,
425
+ # not any head that was passed to us
426
+ my @diff = command('diff-tree', 'HEAD',
427
+ $gs->refname, '--');
428
+ my @finish;
429
+ if (@diff) {
430
+ @finish = rebase_cmd();
431
+ print STDERR "W: HEAD and ", $gs->refname,
432
+ " differ, using @finish:\n",
433
+ "@diff";
434
+ } else {
435
+ print "No changes between current HEAD and ",
436
+ $gs->refname,
437
+ "\nResetting to the latest ",
438
+ $gs->refname, "\n";
439
+ @finish = qw/reset --mixed/;
440
+ }
441
+ command_noisy(@finish, $gs->refname);
442
+ $last_rev = $cmt_rev;
443
}
444
}
415
- return if $_dry_run;
416
- unless ($gs) {
417
- warn "Could not determine fetch information for $url\n",
418
- "Will not attempt to fetch and rebase commits.\n",
419
- "This probably means you have useSvmProps and should\n",
420
- "now resync your SVN::Mirror repository.\n";
421
- return;
422
- }
423
- $_fetch_all ? $gs->fetch_all : $gs->fetch;
424
- unless ($_no_rebase) {
425
- # we always want to rebase against the current HEAD, not any
426
- # head that was passed to us
427
- my @diff = command('diff-tree', 'HEAD', $gs->refname, '--');
428
- my @finish;
429
- if (@diff) {
430
- @finish = rebase_cmd();
431
- print STDERR "W: HEAD and ", $gs->refname, " differ, ",
432
- "using @finish:\n", "@diff";
433
- } else {
434
- print "No changes between current HEAD and ",
435
- $gs->refname, "\nResetting to the latest ",
436
- $gs->refname, "\n";
437
- @finish = qw/reset --mixed/;
438
- }
439
- command_noisy(@finish, $gs->refname);
440
- }
445
}
446
447
sub cmd_find_rev {