Re: git-svn messing with timezones

Previous thread: [PATCH 3/4] gitweb: Simplify fixed string search by Jakub Narebski on Tuesday, February 26, 2008 - 5:22 am. (8 messages)

Next thread: git svn: Cannot rebuild rev_map with --rewrite-root by Eric Kidd on Tuesday, February 26, 2008 - 6:47 am. (1 message)
From: Tim Stoakes
Date: Tuesday, February 26, 2008 - 5:47 am

Hi all,

When I commit to git, the log shows the correct timezone:
  Date:   Tue Feb 26 23:10:24 2008 +1030

However, when I then dcommit this to SVN with git-svn, the timezone gets
mangled. If I now 'git log', the same commit shows
  Date:   Tue Feb 26 12:40:24 2008 +0000

The 'svn log' of that same revision shows the correct timezone:
r151 | foo | 2008-02-26 23:10:24 +1030 (Tue, 26 Feb 2008) | 2 lines
so, I know it's git-svn doing it, not svn itself.

The same mangling has happened to commits that came through the original
git-svn import, and subsequent 'git-svn rebase's.

I've tried things like:
$ TZ=Australia/Adelaide git svn dcommit
all end in the same result - UTC appears in the logs.

I'm using:
git version 1.5.4.3

Can anyone help?
Thanks
Tim

-- 
Tim Stoakes
-

From: Eric Wong
Date: Wednesday, February 27, 2008 - 12:32 am

Hi Tim,

This is actually the intended behavior of git-svn.

SVN itself only stores times in UTC and nothing else.  The SVN
repository itself has no timezone information (unless the server it was
on is misconfigured :)

The regular svn client converts the UTC time to the local time (or
based on the TZ= environment).  Using "git svn log" should mimic the
timezone behavior of the regular svn client.

git-svn will only import times as UTC because that's what SVN
gives it.

As a side effect, this also makes it easier for multiple users to
independently create repositories that result in the same commit SHA1s
(and one of the reasons for using dcommit over git svn set-tree).

-- 
Eric Wong
-

From: Tim Stoakes
Date: Wednesday, February 27, 2008 - 3:26 am

Ah indeed, `git-svn log` does show the correct TZ. How annoying!

My workflow is to work with native git as much as possible, and interact
with svn as little as is required. This means I have to remember to run
one command to see sane logs of git commits that happen to also be svn
commits, and another one for the normal git commits. There is no
transparency here.

Thanks for clearing that up though Eric. Is it documented anywhere?

Tim

-- 
Tim Stoakes
-

From: Johannes Schindelin
Date: Wednesday, February 27, 2008 - 3:40 am

Hi,


Note: if all you want is such a strange behaviour as svn's (I mean, why 
does it insist to show the dates as if they were done in _your_ 
timezone?):


AFAICT it waits to be written.  By you.

Ciao,
Dscho
-

From: Miklos Vajna
Date: Wednesday, February 27, 2008 - 5:29 am

git svn log mimics the timezone converting behaviour of svn log, but this was
undocumented.

Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
---


something like this?


 Documentation/git-svn.txt |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/Documentation/git-svn.txt b/Documentation/git-svn.txt
index 340f1be..e1babf3 100644
--- a/Documentation/git-svn.txt
+++ b/Documentation/git-svn.txt
@@ -160,6 +160,10 @@ New features:
 --
 +
 Any other arguments are passed directly to `git log'
++
+NOTE: SVN itself only stores times in UTC and nothing else. The regular svn
+client converts the UTC time to the local time (or based on the TZ=
+environment). This command has the same behaviour.
 
 'blame'::
        Show what revision and author last modified each line of a file. This is
-- 
1.5.4

-

From: Johannes Schindelin
Date: Wednesday, February 27, 2008 - 5:33 am

Hi,


This line is definitely too long.  Please make commit messages readable on 
an 80-character display with a 4-character indent, i.e. 76 

Yes, very nice.  Although I find it sad that an opportunity was lost for a 

I think that this note should come before the "Any other arguments" line.

Ciao,
Dscho

-

From: Miklos Vajna
Date: Wednesday, February 27, 2008 - 6:13 am

git svn log mimics the timezone converting behaviour of svn log, but
this was undocumented.

Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
---




moved.

 Documentation/git-svn.txt |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/Documentation/git-svn.txt b/Documentation/git-svn.txt
index 340f1be..bec9acc 100644
--- a/Documentation/git-svn.txt
+++ b/Documentation/git-svn.txt
@@ -159,6 +159,10 @@ New features:
 	our version of --pretty=oneline
 --
 +
+NOTE: SVN itself only stores times in UTC and nothing else. The regular svn
+client converts the UTC time to the local time (or based on the TZ=
+environment). This command has the same behaviour.
++
 Any other arguments are passed directly to `git log'
 
 'blame'::
-- 
1.5.4

-

From: Johannes Schindelin
Date: Wednesday, February 27, 2008 - 6:15 am

Hi,


Thanks,
Dscho
-

From: Tim Stoakes
Date: Wednesday, February 27, 2008 - 4:09 pm

Ah excellent, that's what I want I think. I'm stuck with SVN for work,
and reviewing commits that appeared to happen at 4am does not do much
for my sanity!

Thanks all.

Tim

-- 
Tim Stoakes
-

From: Junio C Hamano
Date: Wednesday, February 27, 2008 - 4:23 pm

FYI ("you" not referring to Tim in particular but the list
readers in general), the same --date=local can be used in a
repository that talk with CVS.
-

From: Seth Falcon
Date: Wednesday, February 27, 2008 - 9:21 am

You might find it convenient to set an alias in ~/gitconfig like:

    [alias]
            llog = log --date=local

The you can review commits in your TZ via 'git llog'.

+ seth

-- 
Seth Falcon | seth@userprimary.net | blog: http://userprimary.net/user/
-

Previous thread: [PATCH 3/4] gitweb: Simplify fixed string search by Jakub Narebski on Tuesday, February 26, 2008 - 5:22 am. (8 messages)

Next thread: git svn: Cannot rebuild rev_map with --rewrite-root by Eric Kidd on Tuesday, February 26, 2008 - 6:47 am. (1 message)