comparison mercurial/exchange.py @ 23890:7817059917d0

pullbundle2: extract addchangegroup result combining into its own function This will also be used for 'hg unbundle'
author Eric Sumner <ericsumner@fb.com>
date Fri, 16 Jan 2015 12:53:45 -0800
parents c5456b64eb07
children 3b7088a5c64c
comparison
equal deleted inserted replaced
23889:3831e9b3750a 23890:7817059917d0
990 op = bundle2.processbundle(pullop.repo, bundle, pullop.gettransaction) 990 op = bundle2.processbundle(pullop.repo, bundle, pullop.gettransaction)
991 except error.BundleValueError, exc: 991 except error.BundleValueError, exc:
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']:
1014 if namespace == 'phases': 1000 if namespace == 'phases':
1015 _pullapplyphases(pullop, value) 1001 _pullapplyphases(pullop, value)