hgext/phabricator.py
changeset 43259 162b81e65e60
parent 43258 d5d1edf66091
child 43261 f5aa4a53acd1
equal deleted inserted replaced
43258:d5d1edf66091 43259:162b81e65e60
   516         self.newProperties[b'unix:filemode'] = value
   516         self.newProperties[b'unix:filemode'] = value
   517 
   517 
   518     def addhunk(self, hunk):
   518     def addhunk(self, hunk):
   519         if not isinstance(hunk, phabhunk):
   519         if not isinstance(hunk, phabhunk):
   520             raise error.Abort(b'phabchange.addhunk only takes phabhunks')
   520             raise error.Abort(b'phabchange.addhunk only takes phabhunks')
   521         self.hunks.append(hunk)
   521         self.hunks.append(pycompat.byteskwargs(attr.asdict(hunk)))
   522         # It's useful to include these stats since the Phab web UI shows them,
   522         # It's useful to include these stats since the Phab web UI shows them,
   523         # and uses them to estimate how large a change a Revision is. Also used
   523         # and uses them to estimate how large a change a Revision is. Also used
   524         # in email subjects for the [+++--] bit.
   524         # in email subjects for the [+++--] bit.
   525         self.addLines += hunk.addLines
   525         self.addLines += hunk.addLines
   526         self.delLines += hunk.delLines
   526         self.delLines += hunk.delLines
   547     repositoryPHID = attr.ib(default=None)  # camelcase-required
   547     repositoryPHID = attr.ib(default=None)  # camelcase-required
   548 
   548 
   549     def addchange(self, change):
   549     def addchange(self, change):
   550         if not isinstance(change, phabchange):
   550         if not isinstance(change, phabchange):
   551             raise error.Abort(b'phabdiff.addchange only takes phabchanges')
   551             raise error.Abort(b'phabdiff.addchange only takes phabchanges')
   552         self.changes[change.currentPath] = change
   552         self.changes[change.currentPath] = pycompat.byteskwargs(
       
   553             attr.asdict(change)
       
   554         )
   553 
   555 
   554 
   556 
   555 def maketext(pchange, ctx, fname):
   557 def maketext(pchange, ctx, fname):
   556     """populate the phabchange for a text file"""
   558     """populate the phabchange for a text file"""
   557     repo = ctx.repo()
   559     repo = ctx.repo()