code: def merge_with_published(self):
          
          pid, first = self.fetch_published()
          lca = first.revisions[self['_deposit']['pid']['revision_id']]
          # ignore _deposit and $schema field
          args = [lca.dumps(), first.dumps(), self.dumps()]
          for arg in args:
              del arg['$schema'], arg['_deposit']
          args.append({})
          m = Merger(*args)
          try:
              m.run()
          except UnresolvedConflictsException:
              raise MergeConflict()
          return patch(m.unified_patches, lca)
docs: Merge changes with latest published version.