Show More
@@ -42,6 +42,25 b' def closechunk():' | |||||
42 | """return a changegroup chunk header (string) for a zero-length chunk""" |
|
42 | """return a changegroup chunk header (string) for a zero-length chunk""" | |
43 | return struct.pack(">l", 0) |
|
43 | return struct.pack(">l", 0) | |
44 |
|
44 | |||
|
45 | def combineresults(results): | |||
|
46 | """logic to combine 0 or more addchangegroup results into one""" | |||
|
47 | changedheads = 0 | |||
|
48 | result = 1 | |||
|
49 | for ret in results: | |||
|
50 | # If any changegroup result is 0, return 0 | |||
|
51 | if ret == 0: | |||
|
52 | result = 0 | |||
|
53 | break | |||
|
54 | if ret < -1: | |||
|
55 | changedheads += ret + 1 | |||
|
56 | elif ret > 1: | |||
|
57 | changedheads += ret - 1 | |||
|
58 | if changedheads > 0: | |||
|
59 | result = 1 + changedheads | |||
|
60 | elif changedheads < 0: | |||
|
61 | result = -1 + changedheads | |||
|
62 | return result | |||
|
63 | ||||
45 | class nocompress(object): |
|
64 | class nocompress(object): | |
46 | def compress(self, x): |
|
65 | def compress(self, x): | |
47 | return x |
|
66 | return x |
@@ -992,22 +992,8 b' def _pullbundle2(pullop):' | |||||
992 | raise util.Abort('missing support for %s' % exc) |
|
992 | raise util.Abort('missing support for %s' % exc) | |
993 |
|
993 | |||
994 | if pullop.fetch: |
|
994 | if pullop.fetch: | |
995 | changedheads = 0 |
|
995 | results = [cg['return'] for cg in op.records['changegroup']] | |
996 | pullop.cgresult = 1 |
|
996 | pullop.cgresult = changegroup.combineresults(results) | |
997 | for cg in op.records['changegroup']: |
|
|||
998 | ret = cg['return'] |
|
|||
999 | # If any changegroup result is 0, return 0 |
|
|||
1000 | if ret == 0: |
|
|||
1001 | pullop.cgresult = 0 |
|
|||
1002 | break |
|
|||
1003 | if ret < -1: |
|
|||
1004 | changedheads += ret + 1 |
|
|||
1005 | elif ret > 1: |
|
|||
1006 | changedheads += ret - 1 |
|
|||
1007 | if changedheads > 0: |
|
|||
1008 | pullop.cgresult = 1 + changedheads |
|
|||
1009 | elif changedheads < 0: |
|
|||
1010 | pullop.cgresult = -1 + changedheads |
|
|||
1011 |
|
997 | |||
1012 | # processing phases change |
|
998 | # processing phases change | |
1013 | for namespace, value in op.records['listkeys']: |
|
999 | for namespace, value in op.records['listkeys']: |
General Comments 0
You need to be logged in to leave comments.
Login now