mercurial/commands.py
changeset 12750 05bd2658bbb3
parent 12727 52971985be14
child 12754 eaac5e8cb637
equal deleted inserted replaced
12749:338b4b615d33 12750:05bd2658bbb3
  2561     Files that changed between either parent are marked as changed for
  2561     Files that changed between either parent are marked as changed for
  2562     the next commit and a commit must be performed before any further
  2562     the next commit and a commit must be performed before any further
  2563     updates to the repository are allowed. The next commit will have
  2563     updates to the repository are allowed. The next commit will have
  2564     two parents.
  2564     two parents.
  2565 
  2565 
       
  2566     ``--tool`` can be used to specify the merge tool used for file
       
  2567     merges. It overrides the HGMERGE environment variable and your
       
  2568     configuration files.
       
  2569 
  2566     If no revision is specified, the working directory's parent is a
  2570     If no revision is specified, the working directory's parent is a
  2567     head revision, and the current branch contains exactly one other
  2571     head revision, and the current branch contains exactly one other
  2568     head, the other head is merged with by default. Otherwise, an
  2572     head, the other head is merged with by default. Otherwise, an
  2569     explicit revision with which to merge with must be provided.
  2573     explicit revision with which to merge with must be provided.
  2570 
  2574 
       
  2575     :hg:`resolve` must be used to resolve unresolved files.
       
  2576 
  2571     To undo an uncommitted merge, use :hg:`update --clean .` which
  2577     To undo an uncommitted merge, use :hg:`update --clean .` which
  2572     will check out a clean copy of the original merge parent, losing
  2578     will check out a clean copy of the original merge parent, losing
  2573     all changes.
  2579     all changes.
  2574 
  2580 
  2575     Returns 0 on success, 1 if there are unresolved files.
  2581     Returns 0 on success, 1 if there are unresolved files.
  2577 
  2583 
  2578     if opts.get('rev') and node:
  2584     if opts.get('rev') and node:
  2579         raise util.Abort(_("please specify just one revision"))
  2585         raise util.Abort(_("please specify just one revision"))
  2580     if not node:
  2586     if not node:
  2581         node = opts.get('rev')
  2587         node = opts.get('rev')
       
  2588 
       
  2589     t = opts.get('tool')
       
  2590     if t:
       
  2591         if 'HGMERGE' in os.environ:
       
  2592             os.environ['HGMERGE'] = t
       
  2593         ui.setconfig('ui', 'merge', t)
  2582 
  2594 
  2583     if not node:
  2595     if not node:
  2584         branch = repo.changectx(None).branch()
  2596         branch = repo.changectx(None).branch()
  2585         bheads = repo.branchheads(branch)
  2597         bheads = repo.branchheads(branch)
  2586         if len(bheads) > 2:
  2598         if len(bheads) > 2:
  2930     :hg:`merge` has been run, and before :hg:`commit` is run (i.e. the
  2942     :hg:`merge` has been run, and before :hg:`commit` is run (i.e. the
  2931     working directory must have two parents).
  2943     working directory must have two parents).
  2932 
  2944 
  2933     The resolve command can be used in the following ways:
  2945     The resolve command can be used in the following ways:
  2934 
  2946 
  2935     - :hg:`resolve FILE...`: attempt to re-merge the specified files,
  2947     - :hg:`resolve [--tool] FILE...`: attempt to re-merge the specified
  2936       discarding any previous merge attempts. Re-merging is not
  2948       files, discarding any previous merge attempts. Re-merging is not
  2937       performed for files already marked as resolved. Use ``--all/-a``
  2949       performed for files already marked as resolved. Use ``--all/-a``
  2938       to selects all unresolved files.
  2950       to selects all unresolved files. ``--tool`` can be used to specify
       
  2951       the merge tool used for the given files. It overrides the HGMERGE
       
  2952       environment variable and your configuration files.
  2939 
  2953 
  2940     - :hg:`resolve -m [FILE]`: mark a file as having been resolved
  2954     - :hg:`resolve -m [FILE]`: mark a file as having been resolved
  2941       (e.g. after having manually fixed-up the files). The default is
  2955       (e.g. after having manually fixed-up the files). The default is
  2942       to mark all unresolved files.
  2956       to mark all unresolved files.
  2943 
  2957 
  2962     if pats and all:
  2976     if pats and all:
  2963         raise util.Abort(_("can't specify --all and patterns"))
  2977         raise util.Abort(_("can't specify --all and patterns"))
  2964     if not (all or pats or show or mark or unmark):
  2978     if not (all or pats or show or mark or unmark):
  2965         raise util.Abort(_('no files or directories specified; '
  2979         raise util.Abort(_('no files or directories specified; '
  2966                            'use --all to remerge all files'))
  2980                            'use --all to remerge all files'))
       
  2981 
       
  2982     t = opts.get('tool')
       
  2983     if t:
       
  2984         if 'HGMERGE' in os.environ:
       
  2985             os.environ['HGMERGE'] = t
       
  2986         ui.setconfig('ui', 'merge', t)
  2967 
  2987 
  2968     ms = mergemod.mergestate(repo)
  2988     ms = mergemod.mergestate(repo)
  2969     m = cmdutil.match(repo, pats, opts)
  2989     m = cmdutil.match(repo, pats, opts)
  2970     ret = 0
  2990     ret = 0
  2971 
  2991 
  4268            _('revision to display'), _('REV'))],
  4288            _('revision to display'), _('REV'))],
  4269          _('[-r REV]')),
  4289          _('[-r REV]')),
  4270     "^merge":
  4290     "^merge":
  4271         (merge,
  4291         (merge,
  4272          [('f', 'force', None, _('force a merge with outstanding changes')),
  4292          [('f', 'force', None, _('force a merge with outstanding changes')),
       
  4293           ('t', 'tool', '', _('specify merge tool')),
  4273           ('r', 'rev', '',
  4294           ('r', 'rev', '',
  4274            _('revision to merge'), _('REV')),
  4295            _('revision to merge'), _('REV')),
  4275           ('P', 'preview', None,
  4296           ('P', 'preview', None,
  4276            _('review revisions to merge (no merge is performed)'))],
  4297            _('review revisions to merge (no merge is performed)'))],
  4277          _('[-P] [-f] [[-r] REV]')),
  4298          _('[-P] [-f] [[-r] REV]')),
  4336         (resolve,
  4357         (resolve,
  4337          [('a', 'all', None, _('select all unresolved files')),
  4358          [('a', 'all', None, _('select all unresolved files')),
  4338           ('l', 'list', None, _('list state of files needing merge')),
  4359           ('l', 'list', None, _('list state of files needing merge')),
  4339           ('m', 'mark', None, _('mark files as resolved')),
  4360           ('m', 'mark', None, _('mark files as resolved')),
  4340           ('u', 'unmark', None, _('mark files as unresolved')),
  4361           ('u', 'unmark', None, _('mark files as unresolved')),
       
  4362           ('t', 'tool', '', _('specify merge tool')),
  4341           ('n', 'no-status', None, _('hide status prefix'))]
  4363           ('n', 'no-status', None, _('hide status prefix'))]
  4342           + walkopts,
  4364           + walkopts,
  4343           _('[OPTION]... [FILE]...')),
  4365           _('[OPTION]... [FILE]...')),
  4344     "revert":
  4366     "revert":
  4345         (revert,
  4367         (revert,