mercurial/bundle2.py
changeset 50399 bcf54837241d
parent 50392 385a4f8056e5
child 50517 cd2a2963b982
equal deleted inserted replaced
50398:cc712ce3361f 50399:bcf54837241d
  1701     outgoing,
  1701     outgoing,
  1702     opts,
  1702     opts,
  1703     vfs=None,
  1703     vfs=None,
  1704     compression=None,
  1704     compression=None,
  1705     compopts=None,
  1705     compopts=None,
       
  1706     allow_internal=False,
  1706 ):
  1707 ):
  1707     if bundletype.startswith(b'HG10'):
  1708     if bundletype.startswith(b'HG10'):
  1708         cg = changegroup.makechangegroup(repo, outgoing, b'01', source)
  1709         cg = changegroup.makechangegroup(repo, outgoing, b'01', source)
  1709         return writebundle(
  1710         return writebundle(
  1710             ui,
  1711             ui,
  1715             compression=compression,
  1716             compression=compression,
  1716             compopts=compopts,
  1717             compopts=compopts,
  1717         )
  1718         )
  1718     elif not bundletype.startswith(b'HG20'):
  1719     elif not bundletype.startswith(b'HG20'):
  1719         raise error.ProgrammingError(b'unknown bundle type: %s' % bundletype)
  1720         raise error.ProgrammingError(b'unknown bundle type: %s' % bundletype)
       
  1721 
       
  1722     # enforce that no internal phase are to be bundled
       
  1723     bundled_internal = repo.revs(b"%ln and _internal()", outgoing.ancestorsof)
       
  1724     if bundled_internal and not allow_internal:
       
  1725         count = len(repo.revs(b'%ln and _internal()', outgoing.missing))
       
  1726         msg = "backup bundle would contains %d internal changesets"
       
  1727         msg %= count
       
  1728         raise error.ProgrammingError(msg)
  1720 
  1729 
  1721     caps = {}
  1730     caps = {}
  1722     if opts.get(b'obsolescence', False):
  1731     if opts.get(b'obsolescence', False):
  1723         caps[b'obsmarkers'] = (b'V1',)
  1732         caps[b'obsmarkers'] = (b'V1',)
  1724     bundle = bundle20(ui, caps)
  1733     bundle = bundle20(ui, caps)