mercurial/wireprotov2server.py
changeset 39819 d059cb669632
parent 39818 c30faea8d02d
child 39820 d3d333ab167a
equal deleted inserted replaced
39818:c30faea8d02d 39819:d059cb669632
   750 
   750 
   751         if b'bookmarks' in fields and node in nodebookmarks:
   751         if b'bookmarks' in fields and node in nodebookmarks:
   752             d[b'bookmarks'] = sorted(nodebookmarks[node])
   752             d[b'bookmarks'] = sorted(nodebookmarks[node])
   753             del nodebookmarks[node]
   753             del nodebookmarks[node]
   754 
   754 
   755         revisiondata = None
   755         followingmeta = []
       
   756         followingdata = []
   756 
   757 
   757         if b'revision' in fields:
   758         if b'revision' in fields:
   758             revisiondata = cl.revision(node, raw=True)
   759             revisiondata = cl.revision(node, raw=True)
   759             d[b'revisionsize'] = len(revisiondata)
   760             followingmeta.append((b'revision', len(revisiondata)))
       
   761             followingdata.append(revisiondata)
   760 
   762 
   761         # TODO make it possible for extensions to wrap a function or register
   763         # TODO make it possible for extensions to wrap a function or register
   762         # a handler to service custom fields.
   764         # a handler to service custom fields.
   763 
   765 
       
   766         if followingmeta:
       
   767             d[b'fieldsfollowing'] = followingmeta
       
   768 
   764         yield d
   769         yield d
   765 
   770 
   766         if revisiondata is not None:
   771         for extra in followingdata:
   767             yield revisiondata
   772             yield extra
   768 
   773 
   769     # If requested, send bookmarks from nodes that didn't have revision
   774     # If requested, send bookmarks from nodes that didn't have revision
   770     # data sent so receiver is aware of any bookmark updates.
   775     # data sent so receiver is aware of any bookmark updates.
   771     if b'bookmarks' in fields:
   776     if b'bookmarks' in fields:
   772         for node, marks in sorted(nodebookmarks.iteritems()):
   777         for node, marks in sorted(nodebookmarks.iteritems()):
   863         }
   868         }
   864 
   869 
   865         if b'parents' in fields:
   870         if b'parents' in fields:
   866             d[b'parents'] = store.parents(node)
   871             d[b'parents'] = store.parents(node)
   867 
   872 
       
   873         followingmeta = []
       
   874         followingdata = []
       
   875 
   868         if b'revision' in fields:
   876         if b'revision' in fields:
   869             assert delta is not None
   877             assert delta is not None
   870             assert delta.flags == 0
   878             assert delta.flags == 0
   871             assert d[b'node'] == delta.node
   879             assert d[b'node'] == delta.node
   872 
   880 
   873             if delta.revision is not None:
   881             if delta.revision is not None:
   874                 revisiondata = delta.revision
   882                 followingmeta.append((b'revision', len(delta.revision)))
   875                 d[b'revisionsize'] = len(revisiondata)
   883                 followingdata.append(delta.revision)
   876             else:
   884             else:
   877                 d[b'deltabasenode'] = delta.basenode
   885                 d[b'deltabasenode'] = delta.basenode
   878                 revisiondata = delta.delta
   886                 followingmeta.append((b'delta', len(delta.delta)))
   879                 d[b'deltasize'] = len(revisiondata)
   887                 followingdata.append(delta.delta)
   880         else:
   888 
   881             revisiondata = None
   889         if followingmeta:
       
   890             d[b'fieldsfollowing'] = followingmeta
   882 
   891 
   883         yield d
   892         yield d
   884 
   893 
   885         if revisiondata is not None:
   894         for extra in followingdata:
   886             yield revisiondata
   895             yield extra
   887 
   896 
   888     if deltas is not None:
   897     if deltas is not None:
   889         try:
   898         try:
   890             next(deltas)
   899             next(deltas)
   891             raise error.ProgrammingError('should not have more deltas')
   900             raise error.ProgrammingError('should not have more deltas')
  1018         }
  1027         }
  1019 
  1028 
  1020         if b'parents' in fields:
  1029         if b'parents' in fields:
  1021             d[b'parents'] = store.parents(node)
  1030             d[b'parents'] = store.parents(node)
  1022 
  1031 
       
  1032         followingmeta = []
       
  1033         followingdata = []
       
  1034 
  1023         if b'revision' in fields:
  1035         if b'revision' in fields:
  1024             assert delta is not None
  1036             assert delta is not None
  1025             assert delta.flags == 0
  1037             assert delta.flags == 0
  1026             assert d[b'node'] == delta.node
  1038             assert d[b'node'] == delta.node
  1027 
  1039 
  1028             if delta.revision is not None:
  1040             if delta.revision is not None:
  1029                 revisiondata = delta.revision
  1041                 followingmeta.append((b'revision', len(delta.revision)))
  1030                 d[b'revisionsize'] = len(revisiondata)
  1042                 followingdata.append(delta.revision)
  1031             else:
  1043             else:
  1032                 d[b'deltabasenode'] = delta.basenode
  1044                 d[b'deltabasenode'] = delta.basenode
  1033                 revisiondata = delta.delta
  1045                 followingmeta.append((b'delta', len(delta.delta)))
  1034                 d[b'deltasize'] = len(revisiondata)
  1046                 followingdata.append(delta.delta)
  1035         else:
  1047 
  1036             revisiondata = None
  1048         if followingmeta:
       
  1049             d[b'fieldsfollowing'] = followingmeta
  1037 
  1050 
  1038         yield d
  1051         yield d
  1039 
  1052 
  1040         if revisiondata is not None:
  1053         for extra in followingdata:
  1041             yield revisiondata
  1054             yield extra
  1042 
  1055 
  1043     if deltas is not None:
  1056     if deltas is not None:
  1044         try:
  1057         try:
  1045             next(deltas)
  1058             next(deltas)
  1046             raise error.ProgrammingError('should not have more deltas')
  1059             raise error.ProgrammingError('should not have more deltas')