comparison mercurial/exchange.py @ 26700:dbc3d945ba36

exchange: use cg?unpacker.apply() instead of changegroup.addchangegroup()
author Augie Fackler <augie@google.com>
date Tue, 13 Oct 2015 17:12:29 -0400
parents 704818fb170d
children 16e69e6b357b
comparison
equal deleted inserted replaced
26699:76f20fc8d54d 26700:dbc3d945ba36
1260 raise error.Abort(_("partial pull cannot be done because " 1260 raise error.Abort(_("partial pull cannot be done because "
1261 "other repository doesn't support " 1261 "other repository doesn't support "
1262 "changegroupsubset.")) 1262 "changegroupsubset."))
1263 else: 1263 else:
1264 cg = pullop.remote.changegroupsubset(pullop.fetch, pullop.heads, 'pull') 1264 cg = pullop.remote.changegroupsubset(pullop.fetch, pullop.heads, 'pull')
1265 pullop.cgresult = changegroup.addchangegroup(pullop.repo, cg, 'pull', 1265 pullop.cgresult = cg.apply(pullop.repo, 'pull', pullop.remote.url())
1266 pullop.remote.url())
1267 1266
1268 def _pullphase(pullop): 1267 def _pullphase(pullop):
1269 # Get remote phases data from remote 1268 # Get remote phases data from remote
1270 if 'phases' in pullop.stepsdone: 1269 if 'phases' in pullop.stepsdone:
1271 return 1270 return
1590 mandatory=False) 1589 mandatory=False)
1591 parts.append(part) 1590 parts.append(part)
1592 raise 1591 raise
1593 else: 1592 else:
1594 lockandtr[1] = repo.lock() 1593 lockandtr[1] = repo.lock()
1595 r = changegroup.addchangegroup(repo, cg, source, url) 1594 r = cg.apply(repo, source, url)
1596 finally: 1595 finally:
1597 lockmod.release(lockandtr[2], lockandtr[1], lockandtr[0]) 1596 lockmod.release(lockandtr[2], lockandtr[1], lockandtr[0])
1598 if recordout is not None: 1597 if recordout is not None:
1599 recordout(repo.ui.popbuffer()) 1598 recordout(repo.ui.popbuffer())
1600 return r 1599 return r
1784 cg = readbundle(ui, fh, 'stream') 1783 cg = readbundle(ui, fh, 'stream')
1785 1784
1786 if isinstance(cg, bundle2.unbundle20): 1785 if isinstance(cg, bundle2.unbundle20):
1787 bundle2.processbundle(repo, cg, lambda: tr) 1786 bundle2.processbundle(repo, cg, lambda: tr)
1788 else: 1787 else:
1789 changegroup.addchangegroup(repo, cg, 'clonebundles', url) 1788 cg.apply(repo, 'clonebundles', url)
1790 tr.close() 1789 tr.close()
1791 return True 1790 return True
1792 except urllib2.HTTPError as e: 1791 except urllib2.HTTPError as e:
1793 ui.warn(_('HTTP error fetching bundle: %s\n') % str(e)) 1792 ui.warn(_('HTTP error fetching bundle: %s\n') % str(e))
1794 except urllib2.URLError as e: 1793 except urllib2.URLError as e: