comparison mercurial/commands.py @ 26641:5c57d01fe64e

destupdate: also include bookmark related logic For the same reason, we move the bookmark related update logic into the 'destupdate' function. This requires to extend the returns of the function to include the bookmark that needs to move (more or less) and the bookmark to activate at the end of the function. See function documentation for details on this returns.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Tue, 29 Sep 2015 01:03:26 -0700
parents b13fdcc4e700
children 70ac5f724fbd
comparison
equal deleted inserted replaced
26640:b13fdcc4e700 26641:5c57d01fe64e
6571 6571
6572 See :hg:`help dates` for a list of formats valid for -d/--date. 6572 See :hg:`help dates` for a list of formats valid for -d/--date.
6573 6573
6574 Returns 0 on success, 1 if there are unresolved files. 6574 Returns 0 on success, 1 if there are unresolved files.
6575 """ 6575 """
6576 movemarkfrom = None
6576 if rev and node: 6577 if rev and node:
6577 raise error.Abort(_("please specify just one revision")) 6578 raise error.Abort(_("please specify just one revision"))
6578 6579
6579 if rev is None or rev == '': 6580 if rev is None or rev == '':
6580 rev = node 6581 rev = node
6586 if date: 6587 if date:
6587 if rev is not None: 6588 if rev is not None:
6588 raise error.Abort(_("you can't specify a revision and a date")) 6589 raise error.Abort(_("you can't specify a revision and a date"))
6589 rev = cmdutil.finddate(ui, repo, date) 6590 rev = cmdutil.finddate(ui, repo, date)
6590 6591
6591 # with no argument, we also move the active bookmark, if any
6592 rev, movemarkfrom = bookmarks.calculateupdate(ui, repo, rev)
6593
6594 # if we defined a bookmark, we have to remember the original name 6592 # if we defined a bookmark, we have to remember the original name
6595 brev = rev 6593 brev = rev
6596 rev = scmutil.revsingle(repo, rev, rev).rev() 6594 rev = scmutil.revsingle(repo, rev, rev).rev()
6597 6595
6598 if check and clean: 6596 if check and clean:
6600 ) 6598 )
6601 6599
6602 if check: 6600 if check:
6603 cmdutil.bailifchanged(repo, merge=False) 6601 cmdutil.bailifchanged(repo, merge=False)
6604 if rev is None: 6602 if rev is None:
6605 rev = destutil.destupdate(repo, clean=clean, check=check) 6603 updata = destutil.destupdate(repo, clean=clean, check=check)
6604 rev, movemarkfrom, brev = updata
6606 6605
6607 repo.ui.setconfig('ui', 'forcemerge', tool, 'update') 6606 repo.ui.setconfig('ui', 'forcemerge', tool, 'update')
6608 6607
6609 if clean: 6608 if clean:
6610 ret = hg.clean(repo, rev) 6609 ret = hg.clean(repo, rev)