936 ui.status(_('changeset %s backs out changeset %s\n') % |
936 ui.status(_('changeset %s backs out changeset %s\n') % |
937 (nice(repo.changelog.tip()), nice(node))) |
937 (nice(repo.changelog.tip()), nice(node))) |
938 if op1 != node: |
938 if op1 != node: |
939 if opts['merge']: |
939 if opts['merge']: |
940 ui.status(_('merging with changeset %s\n') % nice(op1)) |
940 ui.status(_('merging with changeset %s\n') % nice(op1)) |
941 doupdate(ui, repo, hex(op1), **opts) |
941 doupdate(ui, repo, hex(op1), merge=True) |
942 else: |
942 else: |
943 ui.status(_('the backout changeset is a new head - ' |
943 ui.status(_('the backout changeset is a new head - ' |
944 'do not forget to merge\n')) |
944 'do not forget to merge\n')) |
945 ui.status(_('(use "backout --merge" ' |
945 ui.status(_('(use "backout --merge" ' |
946 'if you want to auto-merge)\n')) |
946 'if you want to auto-merge)\n')) |
2824 """ |
2824 """ |
2825 ui.warn(_('(the undo command is deprecated; use rollback instead)\n')) |
2825 ui.warn(_('(the undo command is deprecated; use rollback instead)\n')) |
2826 repo.rollback() |
2826 repo.rollback() |
2827 |
2827 |
2828 def update(ui, repo, node=None, merge=False, clean=False, force=None, |
2828 def update(ui, repo, node=None, merge=False, clean=False, force=None, |
2829 branch=None, **opts): |
2829 branch=None): |
2830 """update or merge working directory |
2830 """update or merge working directory |
2831 |
2831 |
2832 Update the working directory to the specified revision. |
2832 Update the working directory to the specified revision. |
2833 |
2833 |
2834 If there are no outstanding changes in the working directory and |
2834 If there are no outstanding changes in the working directory and |
2842 merging or discarding local changes. |
2842 merging or discarding local changes. |
2843 """ |
2843 """ |
2844 if merge: |
2844 if merge: |
2845 ui.warn(_('(the -m/--merge option is deprecated; ' |
2845 ui.warn(_('(the -m/--merge option is deprecated; ' |
2846 'use the merge command instead)\n')) |
2846 'use the merge command instead)\n')) |
2847 return doupdate(ui, repo, node, merge, clean, force, branch, **opts) |
2847 return doupdate(ui, repo, node, merge, clean, force, branch) |
2848 |
2848 |
2849 def doupdate(ui, repo, node=None, merge=False, clean=False, force=None, |
2849 def doupdate(ui, repo, node=None, merge=False, clean=False, force=None, |
2850 branch=None, **opts): |
2850 branch=None): |
2851 if branch: |
2851 if branch: |
2852 br = repo.branchlookup(branch=branch) |
2852 br = repo.branchlookup(branch=branch) |
2853 found = [] |
2853 found = [] |
2854 for x in br: |
2854 for x in br: |
2855 if branch in br[x]: |
2855 if branch in br[x]: |
2856 found.append(x) |
2856 found.append(x) |
2857 if len(found) > 1: |
2857 if len(found) > 1: |
2858 ui.warn(_("Found multiple heads for %s\n") % branch) |
2858 ui.warn(_("Found multiple heads for %s\n") % branch) |
2859 for x in found: |
2859 for x in found: |
2860 show_changeset(ui, repo, opts).show(changenode=x, brinfo=br) |
2860 show_changeset(ui, repo, {}).show(changenode=x, brinfo=br) |
2861 return 1 |
2861 return 1 |
2862 if len(found) == 1: |
2862 if len(found) == 1: |
2863 node = found[0] |
2863 node = found[0] |
2864 ui.warn(_("Using head %s for branch %s\n") % (short(node), branch)) |
2864 ui.warn(_("Using head %s for branch %s\n") % (short(node), branch)) |
2865 else: |
2865 else: |