comparison mercurial/crecord.py @ 38333:03350f5234a4 stable

crecord: fix line number in hunk header (issue5917) `@@ -1,1 +-1,0 @@` is not a valid patch hunk header. Change it to `@@ -1,1 +0,0 @@`. Differential Revision: https://phab.mercurial-scm.org/D3737
author Jun Wu <quark@fb.com>
date Thu, 14 Jun 2018 14:04:26 -0700
parents f0b6fbea00cf
children 00368bc0a614
comparison
equal deleted inserted replaced
38302:6caca2a7d37f 38333:03350f5234a4
396 # but only do this if fromline > 0, to avoid having, e.g fromline=-1. 396 # but only do this if fromline > 0, to avoid having, e.g fromline=-1.
397 fromline, toline = self.fromline, self.toline 397 fromline, toline = self.fromline, self.toline
398 if fromline != 0: 398 if fromline != 0:
399 if fromlen == 0: 399 if fromlen == 0:
400 fromline -= 1 400 fromline -= 1
401 if tolen == 0: 401 if tolen == 0 and toline > 0:
402 toline -= 1 402 toline -= 1
403 403
404 fromtoline = '@@ -%d,%d +%d,%d @@%s\n' % ( 404 fromtoline = '@@ -%d,%d +%d,%d @@%s\n' % (
405 fromline, fromlen, toline, tolen, 405 fromline, fromlen, toline, tolen,
406 self.proc and (' ' + self.proc)) 406 self.proc and (' ' + self.proc))