equal
deleted
inserted
replaced
39 return struct.pack(">l", length + 4) |
39 return struct.pack(">l", length + 4) |
40 |
40 |
41 def closechunk(): |
41 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 |
|
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 |
44 |
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 |
48 def flush(self): |
67 def flush(self): |