Skip to content
Snippets Groups Projects
Commit 7b9aaec1 authored by Matt Harbison's avatar Matt Harbison
Browse files

phabricator: eliminate a couple of duplicate filectx lookups

Differential Revision: https://phab.mercurial-scm.org/D8305
parent a7b7a67b
No related branches found
No related tags found
No related merge requests found
......@@ -819,5 +819,4 @@
pchange = phabchange(
currentPath=fname, oldPath=fname, type=DiffChangeType.DELETE
)
pchange.addoldmode(gitmode[ctx.p1()[fname].flags()])
oldfctx = ctx.p1()[fname]
......@@ -823,4 +822,5 @@
oldfctx = ctx.p1()[fname]
pchange.addoldmode(gitmode[oldfctx.flags()])
if not (oldfctx.isbinary() or notutf8(oldfctx)):
maketext(pchange, ctx, fname)
......@@ -831,5 +831,5 @@
"""add modified files to the phabdiff"""
for fname in modified:
fctx = ctx[fname]
oldfctx = fctx.p1()
oldfctx = ctx.p1()[fname]
pchange = phabchange(currentPath=fname, oldPath=fname)
......@@ -835,6 +835,6 @@
pchange = phabchange(currentPath=fname, oldPath=fname)
filemode = gitmode[ctx[fname].flags()]
originalmode = gitmode[ctx.p1()[fname].flags()]
filemode = gitmode[fctx.flags()]
originalmode = gitmode[oldfctx.flags()]
if filemode != originalmode:
pchange.addoldmode(originalmode)
pchange.addnewmode(filemode)
......@@ -846,7 +846,7 @@
or notutf8(oldfctx)
):
makebinary(pchange, fctx)
addoldbinary(pchange, fctx.p1(), fctx)
addoldbinary(pchange, oldfctx, fctx)
else:
maketext(pchange, ctx, fname)
......@@ -864,7 +864,7 @@
oldfctx = None
pchange = phabchange(currentPath=fname)
filemode = gitmode[ctx[fname].flags()]
filemode = gitmode[fctx.flags()]
renamed = fctx.renamed()
if renamed:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment