[tahoe-dev] how to submit patches

Arno Waschk hamamatsu at gmx.de
Tue Aug 14 21:16:18 UTC 2007


hm, this sounds possible... so if i will do a darcs send next time it is  
only Alzheimer desease, not laziness :)

arno

Am 14.08.2007, 19:28 Uhr, schrieb zooko <zooko at zooko.com>:

>> Brian: Please apply!  :-)
>>
>> Regards,
>>
>> Zooko
>> <patch.darcspatch>
>> <patch.diff.txt>
>
> Well I guess that didn't work so well.  Here is the next attempt, in
> which I attach patch.darcspatch as an attachment and cut and paste
> the diff in-line.
>
> Brian: Please apply!  :-)
>
> Regards,
>
> Zooko
>
> P.S.  It has unit tests, in the pyutil library.
>
> P.P.S.  Let's see if Arno finds it convenient enough to do this kind
> of submission of patches for now.  In the future, we could also set
> up some automation for this...
>
> Tue Aug 14 10:33:49 MDT 2007  zooko at zooko.com
>    * copy pyutil.time_format into src/allmydata/util
>    time_format() provides a good format for logging timestamps
> diff -rN -u old-tahoe/src/allmydata/util/time_format.py new-tahoe/src/
> allmydata/util/time_format.py
> --- old-tahoe/src/allmydata/util/time_format.py	1969-12-31
> 17:00:00.000000000 -0700
> +++ new-tahoe/src/allmydata/util/time_format.py	2007-08-14
> 10:37:36.000000000 -0600
> @@ -0,0 +1,36 @@
> +#  Copyright (c) 2001 Autonomous Zone Industries
> +#  Copyright (c) 2002-2007 Bryce "Zooko" Wilcox-O'Hearn
> +#  This file is licensed under the
> +#    GNU Lesser General Public License v2.1.
> +#    See the file COPYING or visit http://www.gnu.org/ for details.
> +
> +# ISO-8601:
> +# http://www.cl.cam.ac.uk/~mgk25/iso-time.html
> +
> +import datetime, re, time
> +
> +def iso_utc(now=None, sep='_', t=time.time):
> +    if now is None:
> +        now = t()
> +    return datetime.datetime.utcfromtimestamp(now).isoformat(sep)
> +
> +def iso_utc_time_to_localseconds(isotime, _conversion_re=re.compile
> (r"(?P<year>\d{4})-(?P<month>\d{2})-(?P<day>\d{2})[T_](?P<hour>\d{2}):
> (?P<minute>\d{2}):(?P<second>\d{2})(?P<subsecond>\.\d+)?")):
> +    """
> +    The inverse of iso_utc().
> +
> +    Real ISO-8601 is "2003-01-08T06:30:59".  We also accept the widely
> +    used variants "2003-01-08_06:30:59" and "2003-01-08 06:30:59".
> +    """
> +    m = _conversion_re.match(isotime)
> +    if not m:
> +        raise ValueError, (isotime, "not a complete ISO8601 timestamp")
> +    year, month, day = int(m.group('year')), int(m.group('month')),
> int(m.group('day'))
> +    hour, minute, second = int(m.group('hour')), int(m.group
> ('minute')), int(m.group('second'))
> +    utcseconds = time.mktime( (year, month, day, hour, minute,
> second, 0, 1, 0) )
> +    localseconds = utcseconds - time.timezone
> +    subsecstr = m.group('subsecond')
> +    if subsecstr:
> +        subsecfloat = float(subsecstr)
> +        localseconds += subsecfloat
> +    return localseconds
> +
>



-- 
http://www.arnowaschk.de
http://arnowaschk.blogspot.com
http://www.xing.com/go/invite/7018920.9c6816



More information about the tahoe-dev mailing list