D7044: phabricator: add the phabdiff data structure

Kwan (Ian Moody) phabricator at mercurial-scm.org
Thu Oct 10 17:52:17 EDT 2019


Kwan created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  This holds all the data about a commit, and is passed to the
  differential.creatediff API.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D7044

AFFECTED FILES
  hgext/phabricator.py

CHANGE DETAILS

diff --git a/hgext/phabricator.py b/hgext/phabricator.py
--- a/hgext/phabricator.py
+++ b/hgext/phabricator.py
@@ -522,6 +522,32 @@
         self.delLines += hunk.delLines
 
 
+ at attr.s
+class phabdiff(object):
+    """Represents a Differential diff, owns Differential changes.  Corresponds
+    to a commit.
+    """
+
+    # Doesn't seem to be any reason to send this (output of uname -n)
+    sourceMachine = attr.ib(default=b'')
+    sourcePath = attr.ib(default=b'/')
+    sourceControlBaseRevision = attr.ib(default=b'0' * 40)
+    sourceControlPath = attr.ib(default=b'/')
+    sourceControlSystem = attr.ib(default=b'hg')
+    branch = attr.ib(default=b'default')
+    bookmark = attr.ib(default=None)
+    creationMethod = attr.ib(default=b'phabsend')
+    lintStatus = attr.ib(default=b'none')
+    unitStatus = attr.ib(default=b'none')
+    changes = attr.ib(default=attr.Factory(dict))
+    repositoryPHID = attr.ib(default=None)
+
+    def addchange(self, change):
+        if not isinstance(change, phabchange):
+            raise error.Abort(b'phabdiff.addchange only takes phabchanges')
+        self.changes[change.currentPath] = change
+
+
 def creatediff(ctx):
     """create a Differential Diff"""
     repo = ctx.repo()



To: Kwan, #hg-reviewers
Cc: mercurial-devel


More information about the Mercurial-devel mailing list