Merge branch 'bw/get-tz-offset-perl'
authorJunio C Hamano <gitster@pobox.com>
Thu, 14 Feb 2013 18:29:44 +0000 (10:29 -0800)
committerJunio C Hamano <gitster@pobox.com>
Thu, 14 Feb 2013 18:29:44 +0000 (10:29 -0800)
* bw/get-tz-offset-perl:
cvsimport: format commit timestamp ourselves without using strftime
perl/Git.pm: fix get_tz_offset to properly handle DST boundary cases
Move Git::SVN::get_tz to Git::get_tz_offset

1  2 
perl/Git/SVN.pm
diff --combined perl/Git/SVN.pm
index 490e3303804e834497fa1bd3f62500a7b07a31f1,8c84560a495203a47b77faac36e5661aeace5df0..0ebc68ac7e64171acc52abe59063fec48ca3c129
@@@ -11,7 -11,6 +11,6 @@@ use Carp qw/croak/
  use File::Path qw/mkpath/;
  use File::Copy qw/copy/;
  use IPC::Open3;
- use Time::Local;
  use Memoize;  # core since 5.8.0, Jul 2002
  use Memoize::Storable;
  use POSIX qw(:signal_h);
@@@ -22,6 -21,7 +21,7 @@@ use Git qw
      command_noisy
      command_output_pipe
      command_close_pipe
+     get_tz_offset
  );
  use Git::SVN::Utils qw(
        fatal
@@@ -490,7 -490,7 +490,7 @@@ sub refname 
        #
        # Additionally, % must be escaped because it is used for escaping
        # and we want our escaped refname to be reversible
 -      $refname =~ s{([ \%~\^:\?\*\[\t])}{uc sprintf('%%%02x',ord($1))}eg;
 +      $refname =~ s{([ \%~\^:\?\*\[\t])}{sprintf('%%%02X',ord($1))}eg;
  
        # no slash-separated component can begin with a dot .
        # /.* becomes /%2E*
@@@ -1311,14 -1311,6 +1311,6 @@@ sub get_untracked 
        \@out;
  }
  
- sub get_tz {
-       # some systmes don't handle or mishandle %z, so be creative.
-       my $t = shift || time;
-       my $gm = timelocal(gmtime($t));
-       my $sign = qw( + + - )[ $t <=> $gm ];
-       return sprintf("%s%02d%02d", $sign, (gmtime(abs($t - $gm)))[2,1]);
- }
  # parse_svn_date(DATE)
  # --------------------
  # Given a date (in UTC) from Subversion, return a string in the format
@@@ -1351,7 -1343,7 +1343,7 @@@ sub parse_svn_date 
                        delete $ENV{TZ};
                }
  
-               my $our_TZ = get_tz();
+               my $our_TZ = get_tz_offset();
  
                # This converts $epoch_in_UTC into our local timezone.
                my ($sec, $min, $hour, $mday, $mon, $year,
@@@ -2377,7 -2369,7 +2369,7 @@@ sub map_path 
  
  sub uri_encode {
        my ($f) = @_;
 -      $f =~ s#([^a-zA-Z0-9\*!\:_\./\-])#uc sprintf("%%%02x",ord($1))#eg;
 +      $f =~ s#([^a-zA-Z0-9\*!\:_\./\-])#sprintf("%%%02X",ord($1))#eg;
        $f
  }