Mercurial > hg-git
comparison git_handler.py @ 160:3dc1ba5fec31
applied patch removing unused methods from dimichxp
author | Scott Chacon <schacon@gmail.com> |
---|---|
date | Wed, 27 May 2009 17:15:08 -0700 |
parents | 85eae64ca9e2 |
children | 134915637cf7 |
comparison
equal
deleted
inserted
replaced
159:85eae64ca9e2 | 160:3dc1ba5fec31 |
---|---|
16 hex_to_sha, | 16 hex_to_sha, |
17 format_timezone, | 17 format_timezone, |
18 ) | 18 ) |
19 | 19 |
20 import math | 20 import math |
21 | |
22 def seconds_to_offset(time): | |
23 hours = (float(time) / 60 / 60) | |
24 hour_diff = math.fmod(time, 60) | |
25 minutes = int(hour_diff) | |
26 hours = int(math.floor(hours)) | |
27 if hours > 12: | |
28 sign = '+' | |
29 hours = 12 - (hours - 12) | |
30 elif hours > 0: | |
31 sign = '-' | |
32 else: | |
33 sign = '' | |
34 return sign + str(hours).rjust(2, '0') + str(minutes).rjust(2, '0') | |
35 | |
36 def offset_to_seconds(offset): | |
37 if len(offset) == 5: | |
38 sign = offset[0:1] | |
39 hours = int(offset[1:3]) | |
40 minutes = int(offset[3:5]) | |
41 if sign == '+': | |
42 hours = 12 + (12 - hours) | |
43 return (hours * 60 * 60) + (minutes) * 60 | |
44 else: | |
45 return 0 | |
46 | 21 |
47 class GitHandler(object): | 22 class GitHandler(object): |
48 | 23 |
49 def __init__(self, dest_repo, ui): | 24 def __init__(self, dest_repo, ui): |
50 self.repo = dest_repo | 25 self.repo = dest_repo |