Skip to content
Snippets Groups Projects
Commit 8cabda8ae1c6 authored by Scott Chacon's avatar Scott Chacon
Browse files

merge from beejahth

No related branches found
No related tags found
No related merge requests found
......@@ -479,5 +479,7 @@
def parse_timezone(text):
offset = int(text)
signum = (offset < 0) and -1 or 1
offset = abs(offset)
hours = int(offset / 100)
minutes = (offset % 100)
......@@ -482,8 +484,8 @@
hours = int(offset / 100)
minutes = (offset % 100)
return (hours * 3600) + (minutes * 60)
return signum * (hours * 3600 + minutes * 60)
def format_timezone(offset):
if offset % 60 != 0:
raise ValueError("Unable to handle non-minute offset.")
......@@ -485,9 +487,11 @@
def format_timezone(offset):
if offset % 60 != 0:
raise ValueError("Unable to handle non-minute offset.")
return '%+03d%02d' % (offset / 3600, (offset / 60) % 60)
sign = (offset < 0) and '-' or '+'
offset = abs(offset)
return '%c%02d%02d' % (sign, offset / 3600, (offset / 60) % 60)
class Commit(ShaFile):
......
......@@ -13,7 +13,8 @@
ShaFile,
Tag,
Tree,
hex_to_sha
hex_to_sha,
format_timezone,
)
import math
......@@ -230,9 +231,9 @@
author = ctx.user()
if not '>' in author: # TODO : this kills losslessness - die (submodules)?
author = author + ' <none@none>'
commit['author'] = author + ' ' + str(int(time)) + ' ' + seconds_to_offset(timezone)
commit['author'] = author + ' ' + str(int(time)) + ' ' + format_timezone(-timezone)
message = ctx.description()
commit['message'] = ctx.description() + "\n"
extra = ctx.extra()
if 'committer' in extra:
......@@ -234,9 +235,12 @@
message = ctx.description()
commit['message'] = ctx.description() + "\n"
extra = ctx.extra()
if 'committer' in extra:
commit['committer'] = extra['committer']
# fixup timezone
(name_timestamp, timezone) = extra['committer'].rsplit(' ', 1)
timezone = format_timezone(-int(timezone))
commit['committer'] = '%s %s' % (name_timestamp, timezone)
if 'encoding' in extra:
commit['encoding'] = extra['encoding']
......@@ -623,7 +627,7 @@
# if committer is different than author, add it to extra
if not commit._author_raw == commit._committer_raw:
extra['committer'] = commit._committer_raw
extra['committer'] = "%s %d %d" % (commit.committer, commit.commit_time, -commit.commit_timezone)
if commit._encoding:
extra['encoding'] = commit._encoding
......@@ -632,7 +636,7 @@
extra['branch'] = hg_branch
text = strip_message
date = datetime.datetime.fromtimestamp(commit.author_time).strftime("%Y-%m-%d %H:%M:%S")
date = (commit.author_time, -commit.author_timezone)
ctx = context.memctx(self.repo, (p1, p2), text, files, getfilectx,
commit.author, date, extra)
a = self.repo.commitctx(ctx)
......
......@@ -4,7 +4,7 @@
# "$TESTDIR/hghave" git || exit 80
# bail early if the user is already running git-daemon
echo hi | nc localhost 9418 && exit 80
echo hi | nc localhost 9418 2>/dev/null && exit 80
echo "[extensions]" >> $HGRCPATH
echo "hggit=$(echo $(dirname $(dirname $0)))" >> $HGRCPATH
......
......@@ -4,7 +4,7 @@
# "$TESTDIR/hghave" git || exit 80
# bail early if the user is already running git-daemon
echo hi | nc localhost 9418 && exit 80
echo hi | nc localhost 9418 2>/dev/null && exit 80
echo "[extensions]" >> $HGRCPATH
echo "hggit=$(echo $(dirname $(dirname $0)))" >> $HGRCPATH
......
......@@ -4,7 +4,7 @@
# "$TESTDIR/hghave" git || exit 80
# bail early if the user is already running git-daemon
echo hi | nc localhost 9418 && exit 80
echo hi | nc localhost 9418 2>/dev/null && exit 80
echo "[extensions]" >> $HGRCPATH
echo "hggit=$(echo $(dirname $(dirname $0)))" >> $HGRCPATH
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment