Staging
v0.5.1
https://foss.heptapod.net/mercurial/hgview
Revision dd171673c1786405546842634e851a0a1190fbfc authored by Pierre-Yves David on 04 June 2012, 14:45:45 UTC, committed by Pierre-Yves David on 04 June 2012, 14:45:45 UTC

If working directory is clean, it's parent is selected
(if the checked out revision is nullrev, we fallback on the first
available changeset.)

Note: Merge are never clean, choosing first parent is safe.
1 parent ccfd4c7
Raw File
Tip revision: dd171673c1786405546842634e851a0a1190fbfc authored by Pierre-Yves David on 04 June 2012, 14:45:45 UTC
[qt] always select the working directory at startup (closes #82231)
Tip revision: dd17167
decorators.py
# -*- coding: utf-8 -*-
"""
Some useful decorator functions
"""
import time

def timeit(func):
    """Decorator used to time the execution of a function"""
    def timefunc(*args, **kwargs):
        """wrapper"""
        t_1 = time.time()
        t_2 = time.clock()
        res = func(*args, **kwargs)
        t_3 = time.clock()
        t_4 = time.time()
        print "%s: %.2fms (time) %.2fms (clock)" % \
              (func.func_name, 1000*(t_3 - t_2), 1000*(t_4 - t_1))
        return res
    return timefunc
back to top