##// END OF EJS Templates
phabricator: add addremoved and addmodified functions...
Ian Moody -
r43460:c19b3270 default
parent child Browse files
Show More
@@ -684,6 +684,44 b' def makebinary(pchange, fctx):'
684 pchange.fileType = DiffFileType.IMAGE
684 pchange.fileType = DiffFileType.IMAGE
685
685
686
686
687 # Copied from mercurial/patch.py
688 gitmode = {b'l': b'120000', b'x': b'100755', b'': b'100644'}
689
690
691 def addremoved(pdiff, ctx, removed):
692 """add removed files to the phabdiff. Shouldn't include moves"""
693 for fname in removed:
694 pchange = phabchange(
695 currentPath=fname, oldPath=fname, type=DiffChangeType.DELETE
696 )
697 pchange.addoldmode(gitmode[ctx.p1()[fname].flags()])
698 fctx = ctx.p1()[fname]
699 if not fctx.isbinary():
700 maketext(pchange, ctx, fname)
701
702 pdiff.addchange(pchange)
703
704
705 def addmodified(pdiff, ctx, modified):
706 """add modified files to the phabdiff"""
707 for fname in modified:
708 fctx = ctx[fname]
709 pchange = phabchange(currentPath=fname, oldPath=fname)
710 filemode = gitmode[ctx[fname].flags()]
711 originalmode = gitmode[ctx.p1()[fname].flags()]
712 if filemode != originalmode:
713 pchange.addoldmode(originalmode)
714 pchange.addnewmode(filemode)
715
716 if fctx.isbinary():
717 makebinary(pchange, fctx)
718 addoldbinary(pchange, fctx, fname)
719 else:
720 maketext(pchange, ctx, fname)
721
722 pdiff.addchange(pchange)
723
724
687 def creatediff(ctx):
725 def creatediff(ctx):
688 """create a Differential Diff"""
726 """create a Differential Diff"""
689 repo = ctx.repo()
727 repo = ctx.repo()
General Comments 0
You need to be logged in to leave comments. Login now