diff --git a/git-remote-hg b/git-remote-hg index 859eed6..a4689ed 100755 --- a/git-remote-hg +++ b/git-remote-hg @@ -72,12 +72,14 @@ def gitmode(flags): return 'l' in flags and '120000' or 'x' in flags and '100755' or '100644' def gittz(tz): - return '%+03d%02d' % (-tz / 3600, -tz % 3600 / 60) + sign = 1 if tz < 0 else -1 + return '%+03d%02d' % (sign * (abs(tz) / 3600), abs(tz) % 3600 / 60) def hgtz(tz): tz = int(tz) - tz = ((tz / 100) * 3600) + ((tz % 100) * 60) - return -tz + sign = 1 if tz < 0 else -1 + tz = ((abs(tz) / 100) * 3600) + ((abs(tz) % 100) * 60) + return sign * tz def hgmode(mode): m = { '100755': 'x', '120000': 'l' } diff --git a/test/bidi.t b/test/bidi.t index 1c41fea..9bc9821 100755 --- a/test/bidi.t +++ b/test/bidi.t @@ -240,7 +240,7 @@ test_expect_success 'hg tags' ' test_cmp expected actual ' -test_expect_failure 'test timezones' ' +test_expect_success 'test timezones' ' test_when_finished "rm -rf gitrepo* hgrepo*" && ( diff --git a/test/main.t b/test/main.t index 3af4fce..d51021c 100755 --- a/test/main.t +++ b/test/main.t @@ -1052,7 +1052,7 @@ test_expect_success 'push annotated tag' ' test_cmp expected actual ' -test_expect_failure 'timezone issues with negative offsets' ' +test_expect_success 'timezone issues with negative offsets' ' test_when_finished "rm -rf hgrepo gitrepo1 gitrepo2" && hg init hgrepo &&