##// END OF EJS Templates
phabricator: add the maketext function...
Ian Moody -
r43456:f742faba default
parent child Browse files
Show More
@@ -58,6 +58,7 b' from mercurial import ('
58 58 error,
59 59 exthelper,
60 60 httpconnection as httpconnectionmod,
61 match,
61 62 mdiff,
62 63 obsutil,
63 64 parser,
@@ -548,6 +549,36 b' class phabdiff(object):'
548 549 self.changes[change.currentPath] = change
549 550
550 551
552 def maketext(pchange, ctx, fname):
553 """populate the phabchange for a text file"""
554 repo = ctx.repo()
555 fmatcher = match.exact([fname])
556 diffopts = mdiff.diffopts(git=True, context=32767)
557 _pfctx, _fctx, header, fhunks = next(
558 patch.diffhunks(repo, ctx.p1(), ctx, fmatcher, opts=diffopts)
559 )
560
561 for fhunk in fhunks:
562 (oldOffset, oldLength, newOffset, newLength), lines = fhunk
563 corpus = b''.join(lines[1:])
564 shunk = list(header)
565 shunk.extend(lines)
566 _mf, _mt, addLines, delLines, _hb = patch.diffstatsum(
567 patch.diffstatdata(util.iterlines(shunk))
568 )
569 pchange.addhunk(
570 phabhunk(
571 oldOffset,
572 oldLength,
573 newOffset,
574 newLength,
575 corpus,
576 addLines,
577 delLines,
578 )
579 )
580
581
551 582 def creatediff(ctx):
552 583 """create a Differential Diff"""
553 584 repo = ctx.repo()
General Comments 0
You need to be logged in to leave comments. Login now