summaryrefslogtreecommitdiff
path: root/dgit
diff options
context:
space:
mode:
authorIan Jackson <ijackson@chiark.greenend.org.uk>2016-09-26 01:07:05 +0100
committerIan Jackson <ijackson@chiark.greenend.org.uk>2016-09-26 01:36:40 +0100
commitcf7a9ee63c1167d6e3e3c8c95583df4ab2915a22 (patch)
tree11889973a3c6bd716060dc315a53c9fe5a0ccdcb /dgit
parent691b12e13974d68966a397186cc5e310e5582f0f (diff)
Overwrite: Support --overwrite without a version
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Diffstat (limited to 'dgit')
-rwxr-xr-xdgit30
1 files changed, 26 insertions, 4 deletions
diff --git a/dgit b/dgit
index 54337f7..5a37363 100755
--- a/dgit
+++ b/dgit
@@ -63,7 +63,7 @@ our $existing_package = 'dpkg';
our $cleanmode;
our $changes_since_version;
our $rmchanges;
-our $overwrite_version;
+our $overwrite_version; # undef: not specified; '': check changelog
our $quilt_mode;
our $quilt_modes_re = 'linear|smash|auto|nofix|nocheck|gbp|dpm|unapplied';
our $we_are_responder;
@@ -2404,8 +2404,26 @@ sub pseudomerge_version_check ($$) {
my $i_arch_v = [ (getfield $arch_clogp, 'Version'),
'version currently in archive' ];
if (defined $overwrite_version) {
- infopair_cond_equal([ $overwrite_version, '--overwrite= version' ],
- $i_arch_v);
+ if (length $overwrite_version) {
+ infopair_cond_equal([ $overwrite_version,
+ '--overwrite= version' ],
+ $i_arch_v);
+ } else {
+ my $v = $i_arch_v->[0];
+ progress "Checking package changelog for archive version $v ...";
+ eval {
+ my @xa = ("-f$v", "-t$v");
+ my $vclogp = parsechangelog @xa;
+ my $cv = [ (getfield $vclogp, 'Version'),
+ "Version field from dpkg-parsechangelog @xa" ];
+ infopair_cond_equal($i_arch_v, $cv);
+ };
+ if ($@) {
+ $@ =~ s/^dgit: //gm;
+ fail "$@".
+ "Perhaps debian/changelog does not mention $v ?";
+ }
+ }
}
printdebug "pseudomerge_version_check i_arch_v @$i_arch_v\n";
@@ -2423,6 +2441,7 @@ sub pseudomerge_make_commit ($$$$ $$) {
chomp $msg_msg;
$msg_cmd .=
!defined $overwrite_version ? ""
+ : !length $overwrite_version ? " --overwrite"
: " --overwrite=".$overwrite_version;
mkpath '.git/dgit';
@@ -4564,7 +4583,10 @@ sub parseopts () {
} elsif (m/^--no-rm-on-error$/s) {
push @ropts, $_;
$rmonerror = 0;
- } elsif (m/^--overwrite=(.*)$/s) {
+ } elsif (m/^--overwrite$/s) {
+ push @ropts, $_;
+ $overwrite_version = '';
+ } elsif (m/^--overwrite=(.+)$/s) {
push @ropts, $_;
$overwrite_version = $1;
} elsif (m/^--(no-)?rm-old-changes$/s) {