comparison mercurial/commands.py @ 16019:eb85d5f89fef stable

bookmarks: move current bookmark on update -u and bare pull -u (issue3222) Currently, this won't update when a #branch spec is in the URL
author Matt Mackall <mpm@selenic.com>
date Sun, 29 Jan 2012 14:07:45 -0600
parents c7811ca6fb94
children 7f47873d7484
comparison
equal deleted inserted replaced
16018:ed9f40bc346f 16019:eb85d5f89fef
4258 4258
4259 def postincoming(ui, repo, modheads, optupdate, checkout): 4259 def postincoming(ui, repo, modheads, optupdate, checkout):
4260 if modheads == 0: 4260 if modheads == 0:
4261 return 4261 return
4262 if optupdate: 4262 if optupdate:
4263 movemarkfrom = repo['.'].node()
4263 try: 4264 try:
4264 return hg.update(repo, checkout) 4265 ret = hg.update(repo, checkout)
4265 except util.Abort, inst: 4266 except util.Abort, inst:
4266 ui.warn(_("not updating: %s\n" % str(inst))) 4267 ui.warn(_("not updating: %s\n" % str(inst)))
4267 return 0 4268 return 0
4269 if not ret and not checkout:
4270 if bookmarks.update(repo, [movemarkfrom], repo['.'].node()):
4271 ui.status(_("updating bookmark %s\n") % repo._bookmarkcurrent)
4272 return ret
4268 if modheads > 1: 4273 if modheads > 1:
4269 currentbranchheads = len(repo.branchheads()) 4274 currentbranchheads = len(repo.branchheads())
4270 if currentbranchheads == modheads: 4275 if currentbranchheads == modheads:
4271 ui.status(_("(run 'hg heads' to see heads, 'hg merge' to merge)\n")) 4276 ui.status(_("(run 'hg heads' to see heads, 'hg merge' to merge)\n"))
4272 elif currentbranchheads > 1: 4277 elif currentbranchheads > 1: