##// END OF EJS Templates
commands.log: getrenamed() cleanup
Alexander Solovyov -
r9916:3d718761 default
parent child Browse files
Show More
@@ -2017,7 +2017,6 b' def log(ui, repo, *pats, **opts):'
2017 else:
2017 else:
2018 endrev = len(repo)
2018 endrev = len(repo)
2019 rcache = {}
2019 rcache = {}
2020 ncache = {}
2021 def getrenamed(fn, rev):
2020 def getrenamed(fn, rev):
2022 '''looks up all renames for a file (up to endrev) the first
2021 '''looks up all renames for a file (up to endrev) the first
2023 time the file is given. It indexes on the changerev and only
2022 time the file is given. It indexes on the changerev and only
@@ -2025,15 +2024,11 b' def log(ui, repo, *pats, **opts):'
2025 Returns rename info for fn at changerev rev.'''
2024 Returns rename info for fn at changerev rev.'''
2026 if fn not in rcache:
2025 if fn not in rcache:
2027 rcache[fn] = {}
2026 rcache[fn] = {}
2028 ncache[fn] = {}
2029 fl = repo.file(fn)
2027 fl = repo.file(fn)
2030 for i in fl:
2028 for i in fl:
2031 node = fl.node(i)
2032 lr = fl.linkrev(i)
2029 lr = fl.linkrev(i)
2033 renamed = fl.renamed(node)
2030 renamed = fl.renamed(fl.node(i))
2034 rcache[fn][lr] = renamed
2031 rcache[fn][lr] = renamed
2035 if renamed:
2036 ncache[fn][node] = renamed
2037 if lr >= endrev:
2032 if lr >= endrev:
2038 break
2033 break
2039 if rev in rcache[fn]:
2034 if rev in rcache[fn]:
@@ -2041,12 +2036,10 b' def log(ui, repo, *pats, **opts):'
2041
2036
2042 # If linkrev != rev (i.e. rev not found in rcache) fallback to
2037 # If linkrev != rev (i.e. rev not found in rcache) fallback to
2043 # filectx logic.
2038 # filectx logic.
2044
2045 try:
2039 try:
2046 return repo[rev][fn].renamed()
2040 return repo[rev][fn].renamed()
2047 except error.LookupError:
2041 except error.LookupError:
2048 pass
2042 return None
2049 return None
2050
2043
2051 df = False
2044 df = False
2052 if opts["date"]:
2045 if opts["date"]:
General Comments 0
You need to be logged in to leave comments. Login now