comparison mercurial/commands.py @ 2283:e506c14382fd

deprecate 'update -m'. use 'merge' instead.
author Vadim Gelfer <vadim.gelfer@gmail.com>
date Sun, 14 May 2006 21:07:34 -0700
parents e9a0ed9ed4d9
children 3f18d1eea370
comparison
equal deleted inserted replaced
2282:2efa636eb411 2283:e506c14382fd
795 return '%d:%s' % (repo.changelog.rev(node), short(node)) 795 return '%d:%s' % (repo.changelog.rev(node), short(node))
796 ui.status(_('changeset %s backs out changeset %s\n') % 796 ui.status(_('changeset %s backs out changeset %s\n') %
797 (nice(repo.changelog.tip()), nice(node))) 797 (nice(repo.changelog.tip()), nice(node)))
798 if opts['merge'] and op1 != node: 798 if opts['merge'] and op1 != node:
799 ui.status(_('merging with changeset %s\n') % nice(op1)) 799 ui.status(_('merging with changeset %s\n') % nice(op1))
800 update(ui, repo, hex(op1), **opts) 800 doupdate(ui, repo, hex(op1), **opts)
801 801
802 def bundle(ui, repo, fname, dest="default-push", **opts): 802 def bundle(ui, repo, fname, dest="default-push", **opts):
803 """create a changegroup file 803 """create a changegroup file
804 804
805 Generate a compressed changegroup file collecting all changesets 805 Generate a compressed changegroup file collecting all changesets
945 f.write("[paths]\n") 945 f.write("[paths]\n")
946 f.write("default = %s\n" % abspath) 946 f.write("default = %s\n" % abspath)
947 f.close() 947 f.close()
948 948
949 if not opts['noupdate']: 949 if not opts['noupdate']:
950 update(repo.ui, repo) 950 doupdate(repo.ui, repo)
951 951
952 d.close() 952 d.close()
953 953
954 def commit(ui, repo, *pats, **opts): 954 def commit(ui, repo, *pats, **opts):
955 """commit the specified files or all outstanding changes 955 """commit the specified files or all outstanding changes
1954 Merge the contents of the current working directory and the 1954 Merge the contents of the current working directory and the
1955 requested revision. Files that changed between either parent are 1955 requested revision. Files that changed between either parent are
1956 marked as changed for the next commit and a commit must be 1956 marked as changed for the next commit and a commit must be
1957 performed before any further updates are allowed. 1957 performed before any further updates are allowed.
1958 """ 1958 """
1959 return update(ui, repo, node=node, merge=True, **opts) 1959 return doupdate(ui, repo, node=node, merge=True, **opts)
1960 1960
1961 def outgoing(ui, repo, dest="default-push", **opts): 1961 def outgoing(ui, repo, dest="default-push", **opts):
1962 """show changesets not found in destination 1962 """show changesets not found in destination
1963 1963
1964 Show changesets not found in the specified destination repository or 1964 Show changesets not found in the specified destination repository or
2033 def postincoming(ui, repo, modheads, optupdate): 2033 def postincoming(ui, repo, modheads, optupdate):
2034 if modheads == 0: 2034 if modheads == 0:
2035 return 2035 return
2036 if optupdate: 2036 if optupdate:
2037 if modheads == 1: 2037 if modheads == 1:
2038 return update(ui, repo) 2038 return doupdate(ui, repo)
2039 else: 2039 else:
2040 ui.status(_("not updating, since new heads added\n")) 2040 ui.status(_("not updating, since new heads added\n"))
2041 if modheads > 1: 2041 if modheads > 1:
2042 ui.status(_("(run 'hg heads' to see heads, 'hg merge' to merge)\n")) 2042 ui.status(_("(run 'hg heads' to see heads, 'hg merge' to merge)\n"))
2043 else: 2043 else:
2738 2738
2739 If there are no outstanding changes in the working directory and 2739 If there are no outstanding changes in the working directory and
2740 there is a linear relationship between the current version and the 2740 there is a linear relationship between the current version and the
2741 requested version, the result is the requested version. 2741 requested version, the result is the requested version.
2742 2742
2743 Otherwise the result is a merge between the contents of the 2743 To merge the working directory with another revision, use the
2744 current working directory and the requested version. Files that 2744 merge command.
2745 changed between either parent are marked as changed for the next
2746 commit and a commit must be performed before any further updates
2747 are allowed.
2748 2745
2749 By default, update will refuse to run if doing so would require 2746 By default, update will refuse to run if doing so would require
2750 merging or discarding local changes. 2747 merging or discarding local changes.
2751 """ 2748 """
2749 if merge:
2750 ui.warn(_('(the -m/--merge option is deprecated; '
2751 'use the merge command instead)\n'))
2752 return doupdate(ui, repo, node, merge, clean, force, branch, **opts)
2753
2754 def doupdate(ui, repo, node=None, merge=False, clean=False, force=None,
2755 branch=None, **opts):
2752 if branch: 2756 if branch:
2753 br = repo.branchlookup(branch=branch) 2757 br = repo.branchlookup(branch=branch)
2754 found = [] 2758 found = []
2755 for x in br: 2759 for x in br:
2756 if branch in br[x]: 2760 if branch in br[x]:
3113 _('hg unbundle [-u] FILE')), 3117 _('hg unbundle [-u] FILE')),
3114 "debugundo|undo": (undo, [], _('hg undo')), 3118 "debugundo|undo": (undo, [], _('hg undo')),
3115 "^update|up|checkout|co": 3119 "^update|up|checkout|co":
3116 (update, 3120 (update,
3117 [('b', 'branch', '', _('checkout the head of a specific branch')), 3121 [('b', 'branch', '', _('checkout the head of a specific branch')),
3118 ('m', 'merge', None, _('allow merging of branches')), 3122 ('m', 'merge', None, _('allow merging of branches (DEPRECATED)')),
3119 ('C', 'clean', None, _('overwrite locally modified files')), 3123 ('C', 'clean', None, _('overwrite locally modified files')),
3120 ('f', 'force', None, _('force a merge with outstanding changes'))], 3124 ('f', 'force', None, _('force a merge with outstanding changes'))],
3121 _('hg update [-b TAG] [-m] [-C] [-f] [REV]')), 3125 _('hg update [-b TAG] [-m] [-C] [-f] [REV]')),
3122 "verify": (verify, [], _('hg verify')), 3126 "verify": (verify, [], _('hg verify')),
3123 "version": (show_version, [], _('hg version')), 3127 "version": (show_version, [], _('hg version')),