mercurial/commands.py
changeset 12788 de793925862e
parent 12765 5eed9ceebd64
child 12803 a6a0698960cc
equal deleted inserted replaced
12784:763be3cd084a 12788:de793925862e
  2584     if opts.get('rev') and node:
  2584     if opts.get('rev') and node:
  2585         raise util.Abort(_("please specify just one revision"))
  2585         raise util.Abort(_("please specify just one revision"))
  2586     if not node:
  2586     if not node:
  2587         node = opts.get('rev')
  2587         node = opts.get('rev')
  2588 
  2588 
  2589     t = opts.get('tool')
       
  2590     if t:
       
  2591         if 'HGMERGE' in os.environ:
       
  2592             os.environ['HGMERGE'] = ''
       
  2593         ui.setconfig('ui', 'merge', t)
       
  2594 
       
  2595     if not node:
  2589     if not node:
  2596         branch = repo.changectx(None).branch()
  2590         branch = repo.changectx(None).branch()
  2597         bheads = repo.branchheads(branch)
  2591         bheads = repo.branchheads(branch)
  2598         if len(bheads) > 2:
  2592         if len(bheads) > 2:
  2599             raise util.Abort(_(
  2593             raise util.Abort(_(
  2630         for node in nodes:
  2624         for node in nodes:
  2631             displayer.show(repo[node])
  2625             displayer.show(repo[node])
  2632         displayer.close()
  2626         displayer.close()
  2633         return 0
  2627         return 0
  2634 
  2628 
  2635     return hg.merge(repo, node, force=opts.get('force'))
  2629     try:
       
  2630         # ui.forcemerge is an internal variable, do not document
       
  2631         ui.setconfig('ui', 'forcemerge', opts.get('tool', ''))
       
  2632         return hg.merge(repo, node, force=opts.get('force'))
       
  2633     finally:
       
  2634         ui.setconfig('ui', 'forcemerge', '')
  2636 
  2635 
  2637 def outgoing(ui, repo, dest=None, **opts):
  2636 def outgoing(ui, repo, dest=None, **opts):
  2638     """show changesets not found in the destination
  2637     """show changesets not found in the destination
  2639 
  2638 
  2640     Show changesets not found in the specified destination repository
  2639     Show changesets not found in the specified destination repository
  2977         raise util.Abort(_("can't specify --all and patterns"))
  2976         raise util.Abort(_("can't specify --all and patterns"))
  2978     if not (all or pats or show or mark or unmark):
  2977     if not (all or pats or show or mark or unmark):
  2979         raise util.Abort(_('no files or directories specified; '
  2978         raise util.Abort(_('no files or directories specified; '
  2980                            'use --all to remerge all files'))
  2979                            'use --all to remerge all files'))
  2981 
  2980 
  2982     t = opts.get('tool')
       
  2983     if t:
       
  2984         if 'HGMERGE' in os.environ:
       
  2985             os.environ['HGMERGE'] = ''
       
  2986         ui.setconfig('ui', 'merge', t)
       
  2987 
       
  2988     ms = mergemod.mergestate(repo)
  2981     ms = mergemod.mergestate(repo)
  2989     m = cmdutil.match(repo, pats, opts)
  2982     m = cmdutil.match(repo, pats, opts)
  2990     ret = 0
  2983     ret = 0
  2991 
  2984 
  2992     for f in ms:
  2985     for f in ms:
  3008 
  3001 
  3009                 # backup pre-resolve (merge uses .orig for its own purposes)
  3002                 # backup pre-resolve (merge uses .orig for its own purposes)
  3010                 a = repo.wjoin(f)
  3003                 a = repo.wjoin(f)
  3011                 util.copyfile(a, a + ".resolve")
  3004                 util.copyfile(a, a + ".resolve")
  3012 
  3005 
  3013                 # resolve file
  3006                 try:
  3014                 if ms.resolve(f, wctx, mctx):
  3007                     # resolve file
  3015                     ret = 1
  3008                     ui.setconfig('ui', 'forcemerge', opts.get('tool', ''))
       
  3009                     if ms.resolve(f, wctx, mctx):
       
  3010                         ret = 1
       
  3011                 finally:
       
  3012                     ui.setconfig('ui', 'forcemerge', '')
  3016 
  3013 
  3017                 # replace filemerge's .orig file with our resolve file
  3014                 # replace filemerge's .orig file with our resolve file
  3018                 util.rename(a + ".resolve", a + ".orig")
  3015                 util.rename(a + ".resolve", a + ".orig")
  3019 
  3016 
  3020     ms.commit()
  3017     ms.commit()