Skip to content
Snippets Groups Projects
Commit 5c1d4311440d authored by durin42's avatar durin42
Browse files

submodules: only use the ordereddict backport if collections.OrderedDict is unavailable

parent 64eb2789e5bf
No related branches found
No related tags found
No related merge requests found
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())
......
"""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)])
......@@ -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,
)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment