##// END OF EJS Templates
phabricator: pass old `fctx` to `addoldbinary()` instead of inferring it...
Matt Harbison -
r44911:98f7b9cf default
parent child Browse files
Show More
@@ -747,12 +747,14 b' def uploadfile(fctx):'
747 747 return fphid
748 748
749 749
750 def addoldbinary(pchange, fctx):
750 def addoldbinary(pchange, oldfctx, fctx):
751 751 """add the metadata for the previous version of a binary file to the
752 752 phabchange for the new version
753
754 ``oldfctx`` is the previous version of the file; ``fctx`` is the new
755 version of the file, or None if the file is being removed.
753 756 """
754 oldfctx = fctx.p1()
755 if fctx.cmp(oldfctx):
757 if not fctx or fctx.cmp(oldfctx):
756 758 # Files differ, add the old one
757 759 pchange.metadata[b'old:file:size'] = oldfctx.size()
758 760 mimeguess, _enc = mimetypes.guess_type(
@@ -832,7 +834,7 b' def addmodified(pdiff, ctx, modified):'
832 834
833 835 if fctx.isbinary() or notutf8(fctx):
834 836 makebinary(pchange, fctx)
835 addoldbinary(pchange, fctx)
837 addoldbinary(pchange, fctx.p1(), fctx)
836 838 else:
837 839 maketext(pchange, ctx, fname)
838 840
@@ -892,7 +894,7 b' def addadded(pdiff, ctx, added, removed)'
892 894 if fctx.isbinary() or notutf8(fctx):
893 895 makebinary(pchange, fctx)
894 896 if renamed:
895 addoldbinary(pchange, fctx)
897 addoldbinary(pchange, fctx.p1(), fctx)
896 898 else:
897 899 maketext(pchange, ctx, fname)
898 900
General Comments 0
You need to be logged in to leave comments. Login now