mirror of
https://github.com/frej/fast-export.git
synced 2026-01-15 18:52:09 +01:00
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>
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user