mercurial/patch.py
changeset 34260 5ce32fe7df34
parent 34259 c43d055ae405
child 34381 86f3c9760cc4
equal deleted inserted replaced
34259:c43d055ae405 34260:5ce32fe7df34
  1488     ... + 3
  1488     ... + 3
  1489     ... -4
  1489     ... -4
  1490     ...  5
  1490     ...  5
  1491     ...  d
  1491     ...  d
  1492     ... +lastline"""
  1492     ... +lastline"""
  1493     >>> hunks = parsepatch(rawpatch)
  1493     >>> hunks = parsepatch([rawpatch])
  1494     >>> hunkscomingfromfilterpatch = []
  1494     >>> hunkscomingfromfilterpatch = []
  1495     >>> for h in hunks:
  1495     >>> for h in hunks:
  1496     ...     hunkscomingfromfilterpatch.append(h)
  1496     ...     hunkscomingfromfilterpatch.append(h)
  1497     ...     hunkscomingfromfilterpatch.extend(h.hunks)
  1497     ...     hunkscomingfromfilterpatch.extend(h.hunks)
  1498 
  1498 
  1499     >>> reversedhunks = reversehunks(hunkscomingfromfilterpatch)
  1499     >>> reversedhunks = reversehunks(hunkscomingfromfilterpatch)
  1500     >>> from . import util
  1500     >>> from . import util
  1501     >>> fp = util.stringio()
  1501     >>> fp = util.stringio()
  1502     >>> for c in reversedhunks:
  1502     >>> for c in reversedhunks:
  1503     ...      c.write(fp)
  1503     ...      c.write(fp)
  1504     >>> fp.seek(0)
  1504     >>> fp.seek(0) or None
  1505     >>> reversedpatch = fp.read()
  1505     >>> reversedpatch = fp.read()
  1506     >>> print(pycompat.sysstr(reversedpatch))
  1506     >>> print(pycompat.sysstr(reversedpatch))
  1507     diff --git a/folder1/g b/folder1/g
  1507     diff --git a/folder1/g b/folder1/g
  1508     --- a/folder1/g
  1508     --- a/folder1/g
  1509     +++ b/folder1/g
  1509     +++ b/folder1/g