# usages:
#
# git-debrebase [<options>] new-upstream-v0 \
-# <new-version> <orig-commitish> \
+# <new-version> [<orig-commitish> \
# [<extra-orig-name> <extra-orig-commitish> ...] \
-# [<git-rebase options>...]
+# [<git-rebase options>...]]
#
# git-debrebase [<options> --] [<git-rebase options...>]
# git-debrebase [<options>] analyse
sub defaultcmd_rebase () {
my $old = get_head();
- my ($status, $message) = record_ffq_prev_deferred();
- if ($status eq 'deferred' || $status eq 'exists') {
- } else {
- fproblem $status, "could not record ffq-prev: $message";
- fproblems_maybe_bail();
- }
+ record_ffq_auto();
my ($tip,$breakwater) = walk $old;
update_head_postlaunder $old, $tip, 'launder for rebase';
runcmd @git, qw(rebase), @ARGV, $breakwater;
return ('deferred', undef);
}
+sub record_ffq_auto () {
+ my ($status, $message) = record_ffq_prev_deferred();
+ if ($status eq 'deferred' || $status eq 'exists') {
+ } else {
+ fproblem $status, "could not record ffq-prev: $message";
+ fproblems_maybe_bail();
+ }
+}
+
sub cmd_new_upstream_v0 () {
# automatically and unconditionally launders before rebasing
# if rebase --abort is used, laundering has still been done
my %pieces;
- badusage "need NEW-VERSION UPS-COMMITTISH" unless @ARGV >= 2;
+ badusage "need NEW-VERSION [UPS-COMMITTISH]" unless @ARGV >= 1;
# parse args - low commitment
my $new_version = (new Dpkg::Version scalar(shift @ARGV), check => 1);
my $new_upstream_version = $new_version->version();
- my $new_upstream = git_rev_parse shift @ARGV;
+ my $new_upstream = git_rev_parse (shift @ARGV // 'upstream');
+
+ record_ffq_auto();
my $piece = sub {
my ($n, @x) = @_; # may be ''
# now we need to investigate the branch this generates the
# laundered version but we don't switch to it yet
my $old_head = get_head();
- my ($old_laundered_tip,$old_bw,$old_upstream_update) = walk $old_head;
+ my ($old_laundered_tip,$old_bw,$old_anchor) = walk $old_head;
my $old_bw_cl = classify $old_bw;
- my $old_upstream_update_cl = classify $old_upstream_update;
- confess unless $old_upstream_update_cl->{OrigParents};
+ my $old_anchor_cl = classify $old_anchor;
+ confess unless $old_anchor_cl->{OrigParents};
my $old_upstream = parsecommit
- $old_upstream_update_cl->{OrigParents}[0]{CommitId};
+ $old_anchor_cl->{OrigParents}[0]{CommitId};
$piece->('', Old => $old_upstream->{CommitId});
];
};
if (defined $ffq) {
- runcmd @git, qw(update-ref -m),
- "debrebase: converting corresponding main branch to gbp format",
- $ffq, $git_null_obj;
+ push @deferred_updates, "delete $ffq";
}
update_head_checkout $head, $out, "convert to gbp (v0)";
print <<END or die $!;