1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-03 07:55:36 +00:00

Merge branch '1.1.0-fix'

This commit is contained in:
zhengxie
2012-11-05 12:03:30 +08:00

View File

@@ -380,8 +380,17 @@ def get_file_contributors(repo_id, file_path, file_path_hash, file_id):
last_modified = 0
last_commit_id = ''
try:
fc = FileContributors.objects.get(repo_id=repo_id,
file_path_hash=file_path_hash)
# HACK: Fixed the unique key bug in 1.1
# Should be removed in future
fc = FileContributors.objects.filter(repo_id=repo_id,
file_path_hash=file_path_hash)
if not fc:
raise FileContributors.DoesNotExist
else:
if len(fc) > 1:
for e in fc[1:]:
e.delete()
fc = fc[0]
except FileContributors.DoesNotExist:
# has no cache yet
contributors, last_modified, last_commit_id = get_file_contributors_from_revisions (repo_id, file_path)