##// END OF EJS Templates
wireprotov2: extract file object emission to own function...
Gregory Szorc -
r40213:41e2633b default
parent child Browse files
Show More
@@ -975,6 +975,35 b' def getfilestore(repo, proto, path):'
975
975
976 return fl
976 return fl
977
977
978 def emitfilerevisions(revisions, fields):
979 for revision in revisions:
980 d = {
981 b'node': revision.node,
982 }
983
984 if b'parents' in fields:
985 d[b'parents'] = [revision.p1node, revision.p2node]
986
987 followingmeta = []
988 followingdata = []
989
990 if b'revision' in fields:
991 if revision.revision is not None:
992 followingmeta.append((b'revision', len(revision.revision)))
993 followingdata.append(revision.revision)
994 else:
995 d[b'deltabasenode'] = revision.basenode
996 followingmeta.append((b'delta', len(revision.delta)))
997 followingdata.append(revision.delta)
998
999 if followingmeta:
1000 d[b'fieldsfollowing'] = followingmeta
1001
1002 yield d
1003
1004 for extra in followingdata:
1005 yield extra
1006
978 @wireprotocommand(
1007 @wireprotocommand(
979 'filedata',
1008 'filedata',
980 args={
1009 args={
@@ -1026,33 +1055,8 b' def filedata(repo, proto, haveparents, n'
1026 b'totalitems': len(nodes),
1055 b'totalitems': len(nodes),
1027 }
1056 }
1028
1057
1029 for revision in revisions:
1058 for o in emitfilerevisions(revisions, fields):
1030 d = {
1059 yield o
1031 b'node': revision.node,
1032 }
1033
1034 if b'parents' in fields:
1035 d[b'parents'] = [revision.p1node, revision.p2node]
1036
1037 followingmeta = []
1038 followingdata = []
1039
1040 if b'revision' in fields:
1041 if revision.revision is not None:
1042 followingmeta.append((b'revision', len(revision.revision)))
1043 followingdata.append(revision.revision)
1044 else:
1045 d[b'deltabasenode'] = revision.basenode
1046 followingmeta.append((b'delta', len(revision.delta)))
1047 followingdata.append(revision.delta)
1048
1049 if followingmeta:
1050 d[b'fieldsfollowing'] = followingmeta
1051
1052 yield d
1053
1054 for extra in followingdata:
1055 yield extra
1056
1060
1057 @wireprotocommand(
1061 @wireprotocommand(
1058 'heads',
1062 'heads',
General Comments 0
You need to be logged in to leave comments. Login now