aboutsummaryrefslogtreecommitdiff
path: root/lib/App
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2017-05-24 15:54:09 +0300
committerSergey Poznyakoff <gray@gnu.org.ua>2017-05-24 15:58:14 +0300
commit94a2603878b98bc6c10fc3b3fcfbe2d4ba7abdbc (patch)
treedaa64e86302b56d51db0b09d4ee78ea114900e5c /lib/App
parent67de4bd02ae5d3b7c22aea3b01c0fa6521fbc84a (diff)
downloadglacier-94a2603878b98bc6c10fc3b3fcfbe2d4ba7abdbc.tar.gz
glacier-94a2603878b98bc6c10fc3b3fcfbe2d4ba7abdbc.tar.bz2
Bugfixes
* Makefile.PL (MY::postamble): Restore @INC to its original value before returning. * lib/App/Glacier/Command/Sync.pm: Support --dry-run * lib/App/Glacier/DateTime.pm (_fmt_default, _fmt_iso): Do all time calculations in UTC.
Diffstat (limited to 'lib/App')
-rw-r--r--lib/App/Glacier/Command/Sync.pm10
-rw-r--r--lib/App/Glacier/DateTime.pm6
2 files changed, 10 insertions, 6 deletions
diff --git a/lib/App/Glacier/Command/Sync.pm b/lib/App/Glacier/Command/Sync.pm
index 8b5ab9c..a82b71a 100644
--- a/lib/App/Glacier/Command/Sync.pm
+++ b/lib/App/Glacier/Command/Sync.pm
@@ -139,11 +139,13 @@ sub _sync {
$self->debug(1, "$key;".($i+1),"not found");
$i++;
}
- $dir->store($key, $val) if $mod;
+ unless ($self->dry_run) {
+ $dir->store($key, $val) if $mod;
+ }
}
if ($delete && @{$val} == 0) {
$self->debug(1, "deleting $key");
- $dir->delete($key);
+ $dir->delete($key) unless $self->dry_run;
}
});
@@ -158,10 +160,10 @@ sub _sync {
if ($file_name eq '') {
$file_name = $dir->tempname();
}
- my $ver = $dir->add_version($file_name, $val);
+ my $ver = $dir->add_version($file_name, $val) unless $self->dry_run;
$self->debug(1, "incorporating $file_name;$ver");
}
- $dir->update_sync_time;
+ $dir->update_sync_time unless $self->dry_run;
}
1;
diff --git a/lib/App/Glacier/DateTime.pm b/lib/App/Glacier/DateTime.pm
index f1bd08d..9c5459b 100644
--- a/lib/App/Glacier/DateTime.pm
+++ b/lib/App/Glacier/DateTime.pm
@@ -49,8 +49,9 @@ sub strftime {
sub _fmt_default {
my ($dt) = @_;
- my $now = time;
+ my $now = new App::Glacier::DateTime;
$dt = $dt->epoch;
+ $now = $now->epoch;
if ($dt < $now && $now - $dt < 6*31*86400) {
return '%b %d %H:%M';
} else {
@@ -60,8 +61,9 @@ sub _fmt_default {
sub _fmt_iso {
my ($dt) = @_;
- my $now = time;
+ my $now = new App::Glacier::DateTime;
$dt = $dt->epoch;
+ $now = $now->epoch;
if ($dt < $now && $now - $dt < 6*31*86400) {
return '%m-%d %H:%M';
} else {

Return to:

Send suggestions and report system problems to the System administrator.