diff hgext/rebase.py @ 13856:0995eee8ffe4

rebase: add --tool argument for specifying merge tool
author Stefano Tortarolo <stefano.tortarolo@gmail.com>
date Sat, 02 Apr 2011 11:07:05 +0200
parents 46c3043253fb
children ff3c683eb8ff
line wrap: on
line diff
--- a/hgext/rebase.py	Fri Apr 01 22:44:58 2011 +0200
+++ b/hgext/rebase.py	Sat Apr 02 11:07:05 2011 +0200
@@ -114,6 +114,8 @@
             if srcf or basef or destf:
                 raise util.Abort(
                     _('abort and continue do not allow specifying revisions'))
+            if opts.get('tool', False):
+                ui.warn(_('tool option will be ignored\n'))
 
             (originalwd, target, state, skipped, collapsef, keepf,
                                 keepbranchesf, external) = restorestatus(repo)
@@ -167,10 +169,14 @@
                 if len(repo.parents()) == 2:
                     repo.ui.debug('resuming interrupted rebase\n')
                 else:
-                    stats = rebasenode(repo, rev, p1, p2, state)
-                    if stats and stats[3] > 0:
-                        raise util.Abort(_('unresolved conflicts (see hg '
-                                    'resolve, then hg rebase --continue)'))
+                    try:
+                        ui.setconfig('ui', 'forcemerge', opts.get('tool', ''))
+                        stats = rebasenode(repo, rev, p1, p2, state)
+                        if stats and stats[3] > 0:
+                            raise util.Abort(_('unresolved conflicts (see hg '
+                                        'resolve, then hg rebase --continue)'))
+                    finally:
+                        ui.setconfig('ui', 'forcemerge', '')
                 updatedirstate(repo, rev, target, p2)
                 if not collapsef:
                     newrev = concludenode(repo, rev, p1, p2, extrafn=extrafn)
@@ -592,6 +598,7 @@
         ('', 'keepbranches', False, _('keep original branch names')),
         ('', 'detach', False, _('force detaching of source from its original '
                                 'branch')),
+        ('t', 'tool', '', _('specify merge tool')),
         ('c', 'continue', False, _('continue an interrupted rebase')),
         ('a', 'abort', False, _('abort an interrupted rebase'))] +
          templateopts,