mercurial/commands.py
changeset 28269 6e3fdd98b277
parent 28194 7623ba92af72
child 28273 9ac8955d8c45
equal deleted inserted replaced
28268:3643b66d7f71 28269:6e3fdd98b277
  5541                 ui.note(msg)
  5541                 ui.note(msg)
  5542         else:
  5542         else:
  5543             ui.warn(_('no phases changed\n'))
  5543             ui.warn(_('no phases changed\n'))
  5544     return ret
  5544     return ret
  5545 
  5545 
  5546 def postincoming(ui, repo, modheads, optupdate, checkout):
  5546 def postincoming(ui, repo, modheads, optupdate, checkout, brev):
  5547     if modheads == 0:
  5547     if modheads == 0:
  5548         return
  5548         return
  5549     if optupdate:
  5549     if optupdate:
  5550         warndest = False
  5550         warndest = False
  5551         try:
  5551         try:
  5552             brev = checkout
       
  5553             movemarkfrom = None
  5552             movemarkfrom = None
  5554             if not checkout:
  5553             if not checkout:
  5555                 warndest = True
  5554                 warndest = True
  5556                 updata = destutil.destupdate(repo)
  5555                 updata = destutil.destupdate(repo)
  5557                 checkout, movemarkfrom, brev = updata
  5556                 checkout, movemarkfrom, brev = updata
  5653         pullopargs.update(opts.get('opargs', {}))
  5652         pullopargs.update(opts.get('opargs', {}))
  5654         modheads = exchange.pull(repo, other, heads=revs,
  5653         modheads = exchange.pull(repo, other, heads=revs,
  5655                                  force=opts.get('force'),
  5654                                  force=opts.get('force'),
  5656                                  bookmarks=opts.get('bookmark', ()),
  5655                                  bookmarks=opts.get('bookmark', ()),
  5657                                  opargs=pullopargs).cgresult
  5656                                  opargs=pullopargs).cgresult
       
  5657 
       
  5658         # brev is a name, which might be a bookmark to be activated at
       
  5659         # the end of the update. In other words, it is an explicit
       
  5660         # destination of the update
       
  5661         brev = None
       
  5662 
  5658         if checkout:
  5663         if checkout:
  5659             checkout = str(repo.changelog.rev(checkout))
  5664             checkout = str(repo.changelog.rev(checkout))
       
  5665 
       
  5666             # order below depends on implementation of
       
  5667             # hg.addbranchrevs(). opts['bookmark'] is ignored,
       
  5668             # because 'checkout' is determined without it.
       
  5669             if opts.get('rev'):
       
  5670                 brev = opts['rev'][0]
       
  5671             elif opts.get('branch'):
       
  5672                 brev = opts['branch'][0]
       
  5673             else:
       
  5674                 brev = branches[0]
  5660         repo._subtoppath = source
  5675         repo._subtoppath = source
  5661         try:
  5676         try:
  5662             ret = postincoming(ui, repo, modheads, opts.get('update'), checkout)
  5677             ret = postincoming(ui, repo, modheads, opts.get('update'),
       
  5678                                checkout, brev)
  5663 
  5679 
  5664         finally:
  5680         finally:
  5665             del repo._subtoppath
  5681             del repo._subtoppath
  5666 
  5682 
  5667     finally:
  5683     finally:
  6896                           '"hg unbundle"'),
  6912                           '"hg unbundle"'),
  6897                         hint=_('use "hg debugapplystreamclonebundle"'))
  6913                         hint=_('use "hg debugapplystreamclonebundle"'))
  6898             else:
  6914             else:
  6899                 modheads = gen.apply(repo, 'unbundle', 'bundle:' + fname)
  6915                 modheads = gen.apply(repo, 'unbundle', 'bundle:' + fname)
  6900 
  6916 
  6901     return postincoming(ui, repo, modheads, opts.get('update'), None)
  6917     return postincoming(ui, repo, modheads, opts.get('update'), None, None)
  6902 
  6918 
  6903 @command('^update|up|checkout|co',
  6919 @command('^update|up|checkout|co',
  6904     [('C', 'clean', None, _('discard uncommitted changes (no backup)')),
  6920     [('C', 'clean', None, _('discard uncommitted changes (no backup)')),
  6905     ('c', 'check', None,
  6921     ('c', 'check', None,
  6906      _('update across branches if no uncommitted changes')),
  6922      _('update across branches if no uncommitted changes')),