diff options
author | Richard Wilbur <richard.wilbur@gmail.com> | 2014-06-02 20:58:47 -0600 |
---|---|---|
committer | Richard Wilbur <richard.wilbur@gmail.com> | 2014-06-02 20:58:47 -0600 |
commit | 6978da619c1c9dbee6554ffa70484e48b7f1e9d1 (patch) | |
tree | 55f02323fb2f16cd6328112f7be61e402b0f74c2 /cache_manager.py | |
parent | b7b3d7f360c9f8c0d7315aae56bca63ad9f48411 (diff) | |
parent | b7e626f15fd3059686b8925b4e854568519fd92c (diff) | |
download | bzr-fastimport-trunk.tar.gz |
Diffstat (limited to 'cache_manager.py')
-rw-r--r-- | cache_manager.py | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/cache_manager.py b/cache_manager.py index e0f7f90..ed88aa9 100644 --- a/cache_manager.py +++ b/cache_manager.py @@ -28,7 +28,7 @@ from bzrlib.plugins.fastimport import ( from bzrlib.plugins.fastimport.reftracker import ( RefTracker, ) -from fastimport.helpers import ( +from bzrlib.plugins.fastimport.helpers import ( single_plural, ) @@ -275,3 +275,14 @@ class CacheManager(object): return content +def invert_dictset(d): + """Invert a dictionary with keys matching a set of values, turned into lists.""" + # Based on recipe from ASPN + result = {} + for k, c in d.iteritems(): + for v in c: + keys = result.setdefault(v, []) + keys.append(k) + return result + + |