* Add smart branching for commits. (Cyril Brulebois)
* Prefer to commit to the ref that exactly matches what is specified at the
command line.
+ * Send all debug and verbose prints to stderr, reserving stdout for
+ outputting deltas etc.
+ * pristine-tar commit was not generating deltas against the specified
+ upstream branch, but against the unpacked contents of the source tarball.
+ Fix it to use the upstream branch, ensuring that no matter what branch is
+ given, the delta that is created can always recreate the source tarball.
-- Joey Hess <joeyh@debian.org> Tue, 05 Feb 2008 12:54:27 -0500
my $verbose=0;
my $debug=0;
-my $keep=0;
+my $keep=1;
# Force locale to C since tar may output utf-8 filenames differently
# depending on the locale.
}
sub message {
- print "pristine-tar: @_\n";
+ print STDERR "pristine-tar: @_\n";
}
sub debug {
}, "$tempdir/workdir");
}
- doit("tar", "cf", "$tempdir/recreatetarball", "--owner", 0, "--group", 0,
+ my $ret="$tempdir/recreatetarball";
+
+ doit("tar", "cf", $ret, "--owner", 0, "--group", 0,
"--numeric-owner", "-C", "$tempdir/workdir",
"--no-recursion", "--mode", "0644",
- "--files-from", "$tempdir/manifest");
+ "--files-from", "$tempdir/manifest");
+
+ return $ret;
}
sub gentar {
close IN;
}
- recreatetarball($tempdir, getcwd, clobber_source => 0, %opts);
+ my $recreatetarball=recreatetarball($tempdir, getcwd, clobber_source => 0, %opts);
my $out=(-e "$tempdir/wrapper") ? $tarball.".tmp" : $tarball;
- doit("xdelta", "patch", "$tempdir/delta", "$tempdir/recreatetarball", $out);
+ doit("xdelta", "patch", "$tempdir/delta", $recreatetarball, $out);
if (-e "$tempdir/wrapper") {
my $type=`tar xOzf $tempdir/wrapper type`;
sub gendelta {
my $tarball=shift;
my $delta=shift;
+ my %opts=@_;
my $tempdir=tempdir();
-
+
my $stdout=0;
if ($delta eq "-") {
$stdout=1;
}
genmanifest($tarball, "$tempdir/manifest");
- recreatetarball($tempdir, $sourcedir, clobber_source => 1);
- my $ret=system("xdelta delta -0 --pristine $tempdir/recreatetarball $tarball $tempdir/delta") >> 8;
+ my $recreatetarball;
+ if (! exists $opts{recreatetarball}) {
+ my $recreatetarball=recreatetarball($tempdir, $sourcedir, clobber_source => 1);
+ }
+ else {
+ $recreatetarball=$opts{recreatetarball};
+ }
+
+ my $ret=system("xdelta delta -0 --pristine $recreatetarball $tarball $tempdir/delta") >> 8;
# xdelta exits 1 on success if there were differences
if ($ret != 1 && $ret != 0) {
error "xdelta failed with return code $ret";
my $tempdir=tempdir();
my ($sourcedir, $id)=export($upstream);
genmanifest($tarball, "$tempdir/manifest");
- recreatetarball($tempdir, $sourcedir, clobber_source => 1,
- create_missing => 1);
+ my $recreatetarball=recreatetarball($tempdir, $sourcedir,
+ clobber_source => 1, create_missing => 1);
my $pid = open(GENDELTA, "-|");
if (! $pid) {
# child
- gendelta($tarball, "-");
+ gendelta($tarball, "-", recreatetarball => $recreatetarball);
exit 0;
}
local $/=undef;