mercurial/commands.py
changeset 27855 5b675a5665ef
parent 27854 55394c6fe74e
child 27856 2b3a21052be9
equal deleted inserted replaced
27854:55394c6fe74e 27855:5b675a5665ef
  6829 
  6829 
  6830     Returns 0 on success, 1 if an update has unresolved files.
  6830     Returns 0 on success, 1 if an update has unresolved files.
  6831     """
  6831     """
  6832     fnames = (fname1,) + fnames
  6832     fnames = (fname1,) + fnames
  6833 
  6833 
  6834     lock = repo.lock()
  6834     with repo.lock():
  6835     try:
       
  6836         for fname in fnames:
  6835         for fname in fnames:
  6837             f = hg.openpath(ui, fname)
  6836             f = hg.openpath(ui, fname)
  6838             gen = exchange.readbundle(ui, f, fname)
  6837             gen = exchange.readbundle(ui, f, fname)
  6839             if isinstance(gen, bundle2.unbundle20):
  6838             if isinstance(gen, bundle2.unbundle20):
  6840                 tr = repo.transaction('unbundle')
  6839                 tr = repo.transaction('unbundle')
  6859                         _('packed bundles cannot be applied with '
  6858                         _('packed bundles cannot be applied with '
  6860                           '"hg unbundle"'),
  6859                           '"hg unbundle"'),
  6861                         hint=_('use "hg debugapplystreamclonebundle"'))
  6860                         hint=_('use "hg debugapplystreamclonebundle"'))
  6862             else:
  6861             else:
  6863                 modheads = gen.apply(repo, 'unbundle', 'bundle:' + fname)
  6862                 modheads = gen.apply(repo, 'unbundle', 'bundle:' + fname)
  6864     finally:
       
  6865         lock.release()
       
  6866 
  6863 
  6867     return postincoming(ui, repo, modheads, opts.get('update'), None)
  6864     return postincoming(ui, repo, modheads, opts.get('update'), None)
  6868 
  6865 
  6869 @command('^update|up|checkout|co',
  6866 @command('^update|up|checkout|co',
  6870     [('C', 'clean', None, _('discard uncommitted changes (no backup)')),
  6867     [('C', 'clean', None, _('discard uncommitted changes (no backup)')),