##// 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 return fphid
747 return fphid
748
748
749
749
750 def addoldbinary(pchange, fctx):
750 def addoldbinary(pchange, oldfctx, fctx):
751 """add the metadata for the previous version of a binary file to the
751 """add the metadata for the previous version of a binary file to the
752 phabchange for the new version
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()
757 if not fctx or fctx.cmp(oldfctx):
755 if fctx.cmp(oldfctx):
756 # Files differ, add the old one
758 # Files differ, add the old one
757 pchange.metadata[b'old:file:size'] = oldfctx.size()
759 pchange.metadata[b'old:file:size'] = oldfctx.size()
758 mimeguess, _enc = mimetypes.guess_type(
760 mimeguess, _enc = mimetypes.guess_type(
@@ -832,7 +834,7 b' def addmodified(pdiff, ctx, modified):'
832
834
833 if fctx.isbinary() or notutf8(fctx):
835 if fctx.isbinary() or notutf8(fctx):
834 makebinary(pchange, fctx)
836 makebinary(pchange, fctx)
835 addoldbinary(pchange, fctx)
837 addoldbinary(pchange, fctx.p1(), fctx)
836 else:
838 else:
837 maketext(pchange, ctx, fname)
839 maketext(pchange, ctx, fname)
838
840
@@ -892,7 +894,7 b' def addadded(pdiff, ctx, added, removed)'
892 if fctx.isbinary() or notutf8(fctx):
894 if fctx.isbinary() or notutf8(fctx):
893 makebinary(pchange, fctx)
895 makebinary(pchange, fctx)
894 if renamed:
896 if renamed:
895 addoldbinary(pchange, fctx)
897 addoldbinary(pchange, fctx.p1(), fctx)
896 else:
898 else:
897 maketext(pchange, ctx, fname)
899 maketext(pchange, ctx, fname)
898
900
General Comments 0
You need to be logged in to leave comments. Login now