diff --git a/hggit/git_handler.py b/hggit/git_handler.py index 64eb2789e5bfef253ad7495533e84b9827914089_aGdnaXQvZ2l0X2hhbmRsZXIucHk=..5c1d4311440d5f39b2de4def6bc55af8a531f34f_aGdnaXQvZ2l0X2hhbmRsZXIucHk= 100644 --- a/hggit/git_handler.py +++ b/hggit/git_handler.py @@ -1,6 +1,5 @@ import os, math, urllib, re import stat, posixpath, StringIO -import ordereddict from dulwich.errors import HangupException, GitProtocolError from dulwich.index import commit_tree @@ -503,7 +502,7 @@ def iterblobs(self, ctx): if '.hgsubstate' in ctx: - hgsub = ordereddict.OrderedDict() + hgsub = util.OrderedDict() if '.hgsub' in ctx: hgsub = util.parse_hgsub(ctx['.hgsub'].data().splitlines()) hgsubstate = util.parse_hgsubstate(ctx['.hgsubstate'].data().splitlines()) diff --git a/hggit/util.py b/hggit/util.py index 64eb2789e5bfef253ad7495533e84b9827914089_aGdnaXQvdXRpbC5weQ==..5c1d4311440d5f39b2de4def6bc55af8a531f34f_aGdnaXQvdXRpbC5weQ== 100644 --- a/hggit/util.py +++ b/hggit/util.py @@ -1,5 +1,8 @@ """Compatability functions for old Mercurial versions.""" -import ordereddict +try: + from collections import OrderedDict +except ImportError: + from ordereddict import OrderedDict def progress(ui, *args, **kwargs): """Shim for progress on hg < 1.4. Remove when 1.3 is dropped.""" @@ -7,7 +10,7 @@ def parse_hgsub(lines): """Fills OrderedDict with hgsub file content passed as list of lines""" - rv = ordereddict.OrderedDict() + rv = OrderedDict() for l in lines: ls = l.strip(); if not ls or ls[0] == '#': continue @@ -21,7 +24,7 @@ def parse_hgsubstate(lines): """Fills OrderedDict with hgsubtate file content passed as list of lines""" - rv = ordereddict.OrderedDict() + rv = OrderedDict() for l in lines: ls = l.strip(); if not ls or ls[0] == '#': continue @@ -32,4 +35,3 @@ def serialize_hgsubstate(data): """Produces a string from OrderedDict hgsubstate content""" return ''.join(['%s %s\n' % (data[n], n) for n in sorted(data)]) - diff --git a/setup.py b/setup.py index 64eb2789e5bfef253ad7495533e84b9827914089_c2V0dXAucHk=..5c1d4311440d5f39b2de4def6bc55af8a531f34f_c2V0dXAucHk= 100644 --- a/setup.py +++ b/setup.py @@ -3,6 +3,12 @@ except: from distutils.core import setup +try: + from collections import OrderedDict + extra_req = [] +except ImportError: + extra_req = 'ordereddict>=1.1' + setup( name='hg-git', version='0.4.0', @@ -19,5 +25,5 @@ keywords='hg git mercurial', license='GPLv2', packages=['hggit'], - install_requires=['dulwich>=0.8.0', 'ordereddict>=1.1'], + install_requires=['dulwich>=0.8.0'] + extra_req, )