X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=dgit.git;a=blobdiff_plain;f=dgit;h=356b48c6ca1dc6dcdfc51613c9bdd02f987ee486;hp=62feb30281dacd5c0f1bb28aa5d109a9f9141c5b;hb=9a0e08c9ff1d9b3a53e8399290afcee426f76f7c;hpb=4e73f0c77e0a5c679a39c5e78f67adbb217d5922 diff --git a/dgit b/dgit index 62feb302..356b48c6 100755 --- a/dgit +++ b/dgit @@ -4891,6 +4891,53 @@ sub massage_dbp_args ($;$) { return $r; } +sub in_parent (&) { + my ($fn) = @_; + my $wasdir = must_getcwd(); + changedir ".."; + $fn->(); + changedir $wasdir; +} + +sub postbuild_mergechanges ($) { # must run with CWD=.. (eg in in_parent) + my ($msg_if_onlyone) = @_; + # If there is only one .changes file, fail with $msg_if_onlyone, + # or if that is undef, be a no-op. + # Returns the changes file to report to the user. + my $pat = changespat $version; + my @changesfiles = glob $pat; + @changesfiles = sort { + ($b =~ m/_source\.changes$/ <=> $a =~ m/_source\.changes$/) + or $a cmp $b + } @changesfiles; + my $result; + if (@changesfiles==1) { + fail < $a =~ m/_source\.changes$/) - or $a cmp $b - } @changesfiles; - fail <