Mercurial > public > mercurial-scm > hg
comparison mercurial/bundle2.py @ 25518:ca656f3dffd7
bundle2: provide number of changesets information to 'addchangegroup'
We can now link the two efforts and provided more useful information when
pulling changesets.
author | Pierre-Yves David <pierre-yves.david@fb.com> |
---|---|
date | Sun, 07 Jun 2015 15:57:54 -0700 |
parents | 5bee483705e8 |
children | 39f0064a3079 |
comparison
equal
deleted
inserted
replaced
25517:513c31d8652f | 25518:ca656f3dffd7 |
---|---|
1144 """extract the list of supported obsmarkers versions from a bundle2caps dict | 1144 """extract the list of supported obsmarkers versions from a bundle2caps dict |
1145 """ | 1145 """ |
1146 obscaps = caps.get('obsmarkers', ()) | 1146 obscaps = caps.get('obsmarkers', ()) |
1147 return [int(c[1:]) for c in obscaps if c.startswith('V')] | 1147 return [int(c[1:]) for c in obscaps if c.startswith('V')] |
1148 | 1148 |
1149 @parthandler('changegroup', ('version',)) | 1149 @parthandler('changegroup', ('version', 'nbchanges')) |
1150 def handlechangegroup(op, inpart): | 1150 def handlechangegroup(op, inpart): |
1151 """apply a changegroup part on the repo | 1151 """apply a changegroup part on the repo |
1152 | 1152 |
1153 This is a very early implementation that will massive rework before being | 1153 This is a very early implementation that will massive rework before being |
1154 inflicted to any end-user. | 1154 inflicted to any end-user. |
1163 # We should raise an appropriate exception here | 1163 # We should raise an appropriate exception here |
1164 unpacker = changegroup.packermap[unpackerversion][1] | 1164 unpacker = changegroup.packermap[unpackerversion][1] |
1165 cg = unpacker(inpart, 'UN') | 1165 cg = unpacker(inpart, 'UN') |
1166 # the source and url passed here are overwritten by the one contained in | 1166 # the source and url passed here are overwritten by the one contained in |
1167 # the transaction.hookargs argument. So 'bundle2' is a placeholder | 1167 # the transaction.hookargs argument. So 'bundle2' is a placeholder |
1168 ret = changegroup.addchangegroup(op.repo, cg, 'bundle2', 'bundle2') | 1168 nbchangesets = None |
1169 if 'nbchanges' in inpart.params: | |
1170 nbchangesets = int(inpart.params.get('nbchanges')) | |
1171 ret = changegroup.addchangegroup(op.repo, cg, 'bundle2', 'bundle2', | |
1172 expectedtotal=nbchangesets) | |
1169 op.records.add('changegroup', {'return': ret}) | 1173 op.records.add('changegroup', {'return': ret}) |
1170 if op.reply is not None: | 1174 if op.reply is not None: |
1171 # This is definitely not the final form of this | 1175 # This is definitely not the final form of this |
1172 # return. But one need to start somewhere. | 1176 # return. But one need to start somewhere. |
1173 part = op.reply.newpart('reply:changegroup', mandatory=False) | 1177 part = op.reply.newpart('reply:changegroup', mandatory=False) |