diff -r 31723fc15e14 hgsvn/common.py --- a/hgsvn/common.py Mon Oct 19 07:31:27 2009 +0200 +++ b/hgsvn/common.py Sun Nov 01 13:58:15 2009 +0100 @@ -37,19 +37,8 @@ pass -# We import the lock logic from Mercurial if it is available, and fall back -# to a dummy (always successful) lock if not. -try: - from mercurial.lock import lock as _lock - try: - from mercurial.error import LockHeld - except ImportError: - # LockHeld was defined in mercurial.lock in Mercurial < 1.2 - from mercurial.lock import LockHeld - -except ImportError: - _lock = _SimpleFileLock - LockHeld = _LockHeld +_lock = _SimpleFileLock +LockHeld = _LockHeld hgsvn_private_dir = ".hgsvn" diff -r 31723fc15e14 hgsvn/ui.py --- a/hgsvn/ui.py Mon Oct 19 07:31:27 2009 +0200 +++ b/hgsvn/ui.py Sun Nov 01 13:58:15 2009 +0100 @@ -5,31 +5,27 @@ import os import sys -try: - # First try to import the Mercurial implementation. - from mercurial.util import termwidth -except ImportError: - # Fallback to local copy of Mercurial's implementation. - def termwidth(): - if 'COLUMNS' in os.environ: +# Fallback to local copy of Mercurial's implementation. +def termwidth(): + if 'COLUMNS' in os.environ: + try: + return int(os.environ['COLUMNS']) + except ValueError: + pass + try: + import termios, array, fcntl + for dev in (sys.stdout, sys.stdin): try: - return int(os.environ['COLUMNS']) + fd = dev.fileno() + if not os.isatty(fd): + continue + arri = fcntl.ioctl(fd, termios.TIOCGWINSZ, '\0' * 8) + return array.array('h', arri)[1] except ValueError: pass - try: - import termios, array, fcntl - for dev in (sys.stdout, sys.stdin): - try: - fd = dev.fileno() - if not os.isatty(fd): - continue - arri = fcntl.ioctl(fd, termios.TIOCGWINSZ, '\0' * 8) - return array.array('h', arri)[1] - except ValueError: - pass - except ImportError: - pass - return 80 + except ImportError: + pass + return 80 # Log levels