chiark
/
gitweb
/
~ianmdlvl
/
dgit.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
dgit: Allow --deliberately-not-fast-forward to override dgit's fast forward check
[dgit.git]
/
dgit
diff --git
a/dgit
b/dgit
index 44cfb15acfbb3e968b4b6aa6c3083842033ea003..3d3628093e0d42e4ae8d9ac4ed22b05c429611d6 100755
(executable)
--- a/
dgit
+++ b/
dgit
@@
-183,7
+183,8
@@
sub changedir ($) {
}
sub deliberately ($) {
}
sub deliberately ($) {
- return !!grep { $_[0] eq $_ } @deliberatelies;
+ my ($enquiry) = @_;
+ return !!grep { $_ eq "--deliberately-$enquiry" } @deliberatelies;
}
#---------- remote protocol support, common ----------
}
#---------- remote protocol support, common ----------
@@
-410,10
+411,10
@@
sub cmdoutput_errok {
$!=0; $?=0;
{ local $/ = undef; $d = <P>; }
die $! if P->error;
$!=0; $?=0;
{ local $/ = undef; $d = <P>; }
die $! if P->error;
- if (!close P) { printdebug "=>!$?\n"
if $debug>0
; return undef; }
+ if (!close P) { printdebug "=>!$?\n"; return undef; }
chomp $d;
$d =~ m/^.*/;
chomp $d;
$d =~ m/^.*/;
- printdebug "=> \`$&'",(length $' ? '...' : ''),"\n" if $debug>0; #';
+ printdebug "=> \`$&'",(length $' ? '...' : ''),"\n" if $debug
level
>0; #';
return $d;
}
return $d;
}
@@
-531,8
+532,7
@@
sub cfg {
my @cmd = (@git, qw(config --), $c);
my $v;
{
my @cmd = (@git, qw(config --), $c);
my $v;
{
- local ($Debian::Dgit::debug) = $debug-1;
- *debug = *Debian::Dgit::debug; # nnng
+ local ($debuglevel) = $debuglevel-2;
$v = cmdoutput_errok @cmd;
};
if ($?==0) {
$v = cmdoutput_errok @cmd;
};
if ($?==0) {
@@
-1043,9
+1043,9
@@
sub get_archive_dsc () {
" archive told us to expect $digest";
}
my $dscfh = new IO::File \$dscdata, '<' or die $!;
" archive told us to expect $digest";
}
my $dscfh = new IO::File \$dscdata, '<' or die $!;
- printdebug Dumper($dscdata) if $debug>1;
+ printdebug Dumper($dscdata) if $debug
level
>1;
$dsc = parsecontrolfh($dscfh,$dscurl,1);
$dsc = parsecontrolfh($dscfh,$dscurl,1);
- printdebug Dumper($dsc) if $debug>1;
+ printdebug Dumper($dsc) if $debug
level
>1;
my $fmt = getfield $dsc, 'Format';
fail "unsupported source format $fmt, sorry" unless $format_ok{$fmt};
$dsc_checked = !!$digester;
my $fmt = getfield $dsc, 'Format';
fail "unsupported source format $fmt, sorry" unless $format_ok{$fmt};
$dsc_checked = !!$digester;
@@
-1658,7
+1658,8
@@
sub sign_changes ($) {
}
}
}
}
-sub dopush () {
+sub dopush ($) {
+ my ($forceflag) = @_;
printdebug "actually entering push\n";
prep_ud();
printdebug "actually entering push\n";
prep_ud();
@@
-1693,7
+1694,7
@@
sub dopush () {
$dscpath =~ m#^/# ? $dscpath : "../../../$dscpath";
my ($tree,$dir) = mktree_in_ud_from_only_subdir();
changedir '../../../..';
$dscpath =~ m#^/# ? $dscpath : "../../../$dscpath";
my ($tree,$dir) = mktree_in_ud_from_only_subdir();
changedir '../../../..';
- my $diffopt = $debug>0 ? '--exit-code' : '--quiet';
+ my $diffopt = $debug
level
>0 ? '--exit-code' : '--quiet';
my @diffcmd = (@git, qw(diff), $diffopt, $tree);
debugcmd "+",@diffcmd;
$!=0; $?=0;
my @diffcmd = (@git, qw(diff), $diffopt, $tree);
debugcmd "+",@diffcmd;
$!=0; $?=0;
@@
-1737,7
+1738,6
@@
sub dopush () {
responder_send_command("param head $head");
responder_send_command("param csuite $csuite");
responder_send_command("param head $head");
responder_send_command("param csuite $csuite");
- my $forceflag = deliberately('not-fast-forward') ? '+' : '';
if ($forceflag && defined $lastpush_hash) {
git_for_each_tag_referring($lastpush_hash, sub {
my ($objid,$fullrefname,$tagname) = @_;
if ($forceflag && defined $lastpush_hash) {
git_for_each_tag_referring($lastpush_hash, sub {
my ($objid,$fullrefname,$tagname) = @_;
@@
-1902,17
+1902,27
@@
sub cmd_push {
if (check_for_git()) {
git_fetch_us();
}
if (check_for_git()) {
git_fetch_us();
}
+ my $forceflag = '';
if (fetch_from_archive()) {
if (fetch_from_archive()) {
- is_fast_fwd(lrref(), 'HEAD') or
+ if (is_fast_fwd(lrref(), 'HEAD')) {
+ # ok
+ } elsif (deliberately('not-fast-forward') ||
+ deliberately('TEST-not-fast-forward-dgit-only')) {
+ $forceflag = '+';
+ } else {
fail "dgit push: HEAD is not a descendant".
" of the archive's version.\n".
fail "dgit push: HEAD is not a descendant".
" of the archive's version.\n".
- "$us: To overwrite it, use git merge -s ours ".lrref().".";
+ "$us: To overwrite its contents,".
+ " use git merge -s ours ".lrref().".\n".
+ "$us: To rewind history, if permitted by the archive,".
+ " use --deliberately-not-fast-forward";
+ }
} else {
$new_package or
fail "package appears to be new in this suite;".
" if this is intentional, use --new";
}
} else {
$new_package or
fail "package appears to be new in this suite;".
" if this is intentional, use --new";
}
- dopush();
+ dopush(
$forceflag
);
}
#---------- remote commands' implementation ----------
}
#---------- remote commands' implementation ----------
@@
-2698,6
+2708,7
@@
sub cmd_archive_api_query {
badusage "need only 1 subpath argument" unless @ARGV==1;
my ($subpath) = @ARGV;
my @cmd = archive_api_query_cmd($subpath);
badusage "need only 1 subpath argument" unless @ARGV==1;
my ($subpath) = @ARGV;
my @cmd = archive_api_query_cmd($subpath);
+ debugcmd ">",@cmd;
exec @cmd or fail "exec curl: $!\n";
}
exec @cmd or fail "exec curl: $!\n";
}
@@
-2784,7
+2795,7
@@
sub parseopts () {
} elsif (m/^--no-rm-on-error$/s) {
push @ropts, $_;
$rmonerror = 0;
} elsif (m/^--no-rm-on-error$/s) {
push @ropts, $_;
$rmonerror = 0;
- } elsif (m/^--deliberately-($
suite
_re)$/s) {
+ } elsif (m/^--deliberately-($
deliberately
_re)$/s) {
push @ropts, $_;
push @deliberatelies, $&;
} else {
push @ropts, $_;
push @deliberatelies, $&;
} else {
@@
-2802,7
+2813,7
@@
sub parseopts () {
cmd_help();
} elsif (s/^-D/-/) {
push @ropts, $&;
cmd_help();
} elsif (s/^-D/-/) {
push @ropts, $&;
- $debug++;
+ $debug
level
++;
enabledebug();
} elsif (s/^-N/-/) {
push @ropts, $&;
enabledebug();
} elsif (s/^-N/-/) {
push @ropts, $&;