Patchwork D7044: phabricator: add the phabdiff data structure

login
register
mail settings
Submitter phabricator
Date Oct. 11, 2019, 5:54 p.m.
Message ID <cc03b07dcfe8288a3794fe682c2aeb35@localhost.localdomain>
Download mbox | patch
Permalink /patch/42227/
State Not Applicable
Headers show

Comments

phabricator - Oct. 11, 2019, 5:54 p.m.
Kwan added a comment.
Kwan updated this revision to Diff 17075.


  Fix some test-check-code issues, and one test-check-pyflakes unused local.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7044?vs=17050&id=17075

BRANCH
  default

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7044/new/

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

AFFECTED FILES
  hgext/phabricator.py

CHANGE DETAILS




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

Patch

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
 
 
+@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'')  # camelcase-required
+    sourcePath = attr.ib(default=b'/')  # camelcase-required
+    sourceControlBaseRevision = attr.ib(default=b'0' * 40)  # camelcase-required
+    sourceControlPath = attr.ib(default=b'/')  # camelcase-required
+    sourceControlSystem = attr.ib(default=b'hg')  # camelcase-required
+    branch = attr.ib(default=b'default')
+    bookmark = attr.ib(default=None)
+    creationMethod = attr.ib(default=b'phabsend')  # camelcase-required
+    lintStatus = attr.ib(default=b'none')  # camelcase-required
+    unitStatus = attr.ib(default=b'none')  # camelcase-required
+    changes = attr.ib(default=attr.Factory(dict))
+    repositoryPHID = attr.ib(default=None)  # camelcase-required
+
+    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()