no bug, make tree output be hierarchical for modules, rs=foopy
This is a bit of a follow-up to the configuration landing,
making the json of both variants match for modules with
'/' in them. So devtools/client and devtools/shared get
a shared parent devtools, with client and shared being
children.
MozReview-Commit-ID: LaMkgMrM9Fn
--- a/compare_locales/compare.py
+++ b/compare_locales/compare.py
@@ -24,18 +24,20 @@ class Tree(object):
def __init__(self, valuetype):
self.branches = dict()
self.valuetype = valuetype
self.value = None
def __getitem__(self, leaf):
parts = []
if isinstance(leaf, paths.File):
- parts = [p for p in [leaf.locale, leaf.module] if p] + \
- leaf.file.split('/')
+ parts = [] if not leaf.locale else [leaf.locale]
+ if leaf.module:
+ parts += leaf.module.split('/')
+ parts += leaf.file.split('/')
else:
parts = leaf.split('/')
return self.__get(parts)
def __get(self, parts):
common = None
old = None
new = tuple(parts)