# HG changeset patch # User Gregory Szorc # Date 1447551010 28800 # Node ID 6f1f8e88f036f6706ad3ad9b7ba2fcede3bc2b81 # Parent 93bcc73df8d56225ba1720a36865bfdec5dad088 util.datestr: use divmod() We were computing the quotient and remainder of a division operation separately. The built-in divmod() function allows us to do this with a single function call. Do that. diff -r 93bcc73df8d5 -r 6f1f8e88f036 mercurial/util.py --- a/mercurial/util.py Sat Nov 14 17:44:01 2015 -0800 +++ b/mercurial/util.py Sat Nov 14 17:30:10 2015 -0800 @@ -1367,9 +1367,10 @@ if "%1" in format or "%2" in format or "%z" in format: sign = (tz > 0) and "-" or "+" minutes = abs(tz) // 60 + q, r = divmod(minutes, 60) format = format.replace("%z", "%1%2") - format = format.replace("%1", "%c%02d" % (sign, minutes // 60)) - format = format.replace("%2", "%02d" % (minutes % 60)) + format = format.replace("%1", "%c%02d" % (sign, q)) + format = format.replace("%2", "%02d" % r) try: t = time.gmtime(float(t) - tz) except ValueError: