changeset 43183:73d4bc60e389

phabricator: add the phabhunk data structure These store the actual diff data (for UTF-8 text files anyway) and are equivalent to hunks in a patch file. Differential Revision: https://phab.mercurial-scm.org/D7042
author Ian Moody <moz-ian@perix.co.uk>
date Sun, 06 Oct 2019 13:55:04 +0100
parents a66e2844b0c6
children 99ee4afd352f
files hgext/phabricator.py
diffstat 1 files changed, 16 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/phabricator.py	Sun Oct 06 13:50:32 2019 +0100
+++ b/hgext/phabricator.py	Sun Oct 06 13:55:04 2019 +0100
@@ -50,6 +50,7 @@
 from mercurial.node import bin, nullid
 from mercurial.i18n import _
 from mercurial.pycompat import getattr
+from mercurial.thirdparty import attr
 from mercurial import (
     cmdutil,
     context,
@@ -465,6 +466,21 @@
     BINARY = 3
 
 
+@attr.s
+class phabhunk(dict):
+    """Represents a Differential hunk, which is owned by a Differential change
+    """
+
+    oldOffset = attr.ib(default=0)  # camelcase-required
+    oldLength = attr.ib(default=0)  # camelcase-required
+    newOffset = attr.ib(default=0)  # camelcase-required
+    newLength = attr.ib(default=0)  # camelcase-required
+    corpus = attr.ib(default='')
+    # These get added to the phabchange's equivalents
+    addLines = attr.ib(default=0)  # camelcase-required
+    delLines = attr.ib(default=0)  # camelcase-required
+
+
 def creatediff(ctx):
     """create a Differential Diff"""
     repo = ctx.repo()