diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2017-05-24 15:54:09 +0300 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2017-05-24 15:58:14 +0300 |
commit | 94a2603878b98bc6c10fc3b3fcfbe2d4ba7abdbc (patch) | |
tree | daa64e86302b56d51db0b09d4ee78ea114900e5c | |
parent | 67de4bd02ae5d3b7c22aea3b01c0fa6521fbc84a (diff) | |
download | glacier-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.
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | Makefile.PL | 1 | ||||
-rw-r--r-- | lib/App/Glacier/Command/Sync.pm | 10 | ||||
-rw-r--r-- | lib/App/Glacier/DateTime.pm | 6 |
4 files changed, 12 insertions, 6 deletions
@@ -1,4 +1,5 @@ *~ +*.bak .* \#*# TAGS diff --git a/Makefile.PL b/Makefile.PL index 41416f2..9727e87 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -78,6 +78,7 @@ _MAKE_ $s .= "\t\$(NOECHO)sed 's/$mod 3/$command 1/' \$(INST_MAN3DIR)/$mod.\$(MAN3EXT) > \$(INST_MAN1DIR)/$man1file\n" } } + pop @INC; $s .= "\n"; return $s; } 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 { |