Mercurial > public > mercurial-scm > hg
comparison mercurial/commands.py @ 5224:20817af258d8
pull -u: if "url#rev" was given, update to rev
author | Alexis S. L. Carvalho <alexis@cecm.usp.br> |
---|---|
date | Mon, 27 Aug 2007 01:44:35 -0300 |
parents | cbe6e263357b |
children | bfd73b567b3d 5517aa5aafb0 |
comparison
equal
deleted
inserted
replaced
5223:fe55e3d6dc0b | 5224:20817af258d8 |
---|---|
2019 return 1 | 2019 return 1 |
2020 else: | 2020 else: |
2021 for name, path in ui.configitems("paths"): | 2021 for name, path in ui.configitems("paths"): |
2022 ui.write("%s = %s\n" % (name, path)) | 2022 ui.write("%s = %s\n" % (name, path)) |
2023 | 2023 |
2024 def postincoming(ui, repo, modheads, optupdate): | 2024 def postincoming(ui, repo, modheads, optupdate, checkout): |
2025 if modheads == 0: | 2025 if modheads == 0: |
2026 return | 2026 return |
2027 if optupdate: | 2027 if optupdate: |
2028 if modheads <= 1: | 2028 if modheads <= 1 or checkout: |
2029 return hg.update(repo, None) | 2029 return hg.update(repo, checkout) |
2030 else: | 2030 else: |
2031 ui.status(_("not updating, since new heads added\n")) | 2031 ui.status(_("not updating, since new heads added\n")) |
2032 if modheads > 1: | 2032 if modheads > 1: |
2033 ui.status(_("(run 'hg heads' to see heads, 'hg merge' to merge)\n")) | 2033 ui.status(_("(run 'hg heads' to see heads, 'hg merge' to merge)\n")) |
2034 else: | 2034 else: |
2087 else: | 2087 else: |
2088 error = _("Other repository doesn't support revision lookup, so a rev cannot be specified.") | 2088 error = _("Other repository doesn't support revision lookup, so a rev cannot be specified.") |
2089 raise util.Abort(error) | 2089 raise util.Abort(error) |
2090 | 2090 |
2091 modheads = repo.pull(other, heads=revs, force=opts['force']) | 2091 modheads = repo.pull(other, heads=revs, force=opts['force']) |
2092 return postincoming(ui, repo, modheads, opts['update']) | 2092 return postincoming(ui, repo, modheads, opts['update'], checkout) |
2093 | 2093 |
2094 def push(ui, repo, dest=None, **opts): | 2094 def push(ui, repo, dest=None, **opts): |
2095 """push changes to the specified destination | 2095 """push changes to the specified destination |
2096 | 2096 |
2097 Push changes from the local repository to the given destination. | 2097 Push changes from the local repository to the given destination. |
2659 else: | 2659 else: |
2660 f = urllib.urlopen(fname) | 2660 f = urllib.urlopen(fname) |
2661 gen = changegroup.readbundle(f, fname) | 2661 gen = changegroup.readbundle(f, fname) |
2662 modheads = repo.addchangegroup(gen, 'unbundle', 'bundle:' + fname) | 2662 modheads = repo.addchangegroup(gen, 'unbundle', 'bundle:' + fname) |
2663 | 2663 |
2664 return postincoming(ui, repo, modheads, opts['update']) | 2664 return postincoming(ui, repo, modheads, opts['update'], None) |
2665 | 2665 |
2666 def update(ui, repo, node=None, rev=None, clean=False, date=None): | 2666 def update(ui, repo, node=None, rev=None, clean=False, date=None): |
2667 """update working directory | 2667 """update working directory |
2668 | 2668 |
2669 Update the working directory to the specified revision, or the | 2669 Update the working directory to the specified revision, or the |