diff options
author | Rocco Rutte <pdmef@gmx.net> | 2007-10-22 09:50:52 +0200 |
---|---|---|
committer | Rocco Rutte <pdmef@gmx.net> | 2007-10-22 09:50:52 +0200 |
commit | 8551771d2b3ce508a6d901f7cde6818d4e20e361 (patch) | |
tree | d6a4bdaa3118e96a097c6030ae4cc9656e5256cd | |
parent | 3d1f111d302627f93be619088c9d214d4755119b (diff) | |
download | hg-fast-export-8551771d2b3ce508a6d901f7cde6818d4e20e361.tar.gz |
hg2git.py: Allow consumers to modify keys of dicts returned by load_cache()
By default, the key is not changed. This will allow us for fixing up the
off-by-one issue with marks restored using load_cache().
Signed-off-by: Rocco Rutte <pdmef@gmx.net>
-rwxr-xr-x | hg2git.py | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -57,7 +57,10 @@ def get_changeset(ui,repo,revision,authors={}): branch=get_branch(extra.get('branch','master')) return (node,manifest,fixup_user(user,authors),(time,tz),files,desc,branch,extra) -def load_cache(filename): +def mangle_key(key): + return key + +def load_cache(filename,get_key=mangle_key): cache={} if not os.path.exists(filename): return cache @@ -70,7 +73,7 @@ def load_cache(filename): sys.stderr.write('Invalid file format in [%s], line %d\n' % (filename,l)) continue # put key:value in cache, key without ^: - cache[fields[0][1:]]=fields[1].split('\n')[0] + cache[get_key(fields[0][1:])]=fields[1].split('\n')[0] f.close() return cache |