From: Alejandro R. SedeƱo Date: Fri, 19 Feb 2010 18:51:46 +0000 (-0500) Subject: Don't cache information about revisions that are not from svn X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=commitdiff_plain;h=5db3664cb08495297313278fd13c93398f56321f;p=git-svn-keywords.git Don't cache information about revisions that are not from svn --- diff --git a/git-svn-keywords.py b/git-svn-keywords.py index 4abf3b7..838e427 100755 --- a/git-svn-keywords.py +++ b/git-svn-keywords.py @@ -156,28 +156,32 @@ def get_path_info(g, path): # tranlsate that into an svn revision id if not CONFIG.has_option('CommitToRev', commit): - CONFIG.set('CommitToRev',commit,g.git.svn('find-rev', commit)) - write_config = True - file_rev = CONFIG.get('CommitToRev', commit) + file_rev = g.git.svn('find-rev', commit) + if file_rev: + CONFIG.set('CommitToRev', commit, file_rev) + write_config = True + else: + file_rev = CONFIG.get('CommitToRev', commit) # get information about that revision info_dict = {} - if not CONFIG.has_option('RevInfo', file_rev): - for line in g.git.svn('info', path).split("\n"): - k, v = line.split(": ", 1) - if k == 'Last Changed Date': - info_dict['Date'] = v - elif k == 'Last Changed Author': - info_dict['Author'] = v - CONFIG.set('RevInfo', file_rev, info_dict) - write_config = True - else: - info = CONFIG.get('RevInfo', file_rev) - info_dict.update(info if type(info) is dict else eval(info)) - - if write_config: - with open(CONFIG_PATH, 'wb') as f: - CONFIG.write(f) + if file_rev: + if not CONFIG.has_option('RevInfo', file_rev): + for line in g.git.svn('info', path).split("\n"): + k, v = line.split(": ", 1) + if k == 'Last Changed Date': + info_dict['Date'] = v + elif k == 'Last Changed Author': + info_dict['Author'] = v + CONFIG.set('RevInfo', file_rev, info_dict) + write_config = True + else: + info = CONFIG.get('RevInfo', file_rev) + info_dict.update(info if type(info) is dict else eval(info)) + + if write_config: + with open(CONFIG_PATH, 'wb') as f: + CONFIG.write(f) info_dict['Revision'] = file_rev return info_dict