##// END OF EJS Templates
imerge: fix ancestor calculation...
Brendan Cully -
r5239:8860f294 default
parent child Browse files
Show More
@@ -7,7 +7,7 b' imerge - interactive merge'
7
7
8 from mercurial.i18n import _
8 from mercurial.i18n import _
9 from mercurial.node import *
9 from mercurial.node import *
10 from mercurial import commands, cmdutil, fancyopts, hg, merge, util
10 from mercurial import commands, cmdutil, dispatch, fancyopts, hg, merge, util
11 import os, tarfile
11 import os, tarfile
12
12
13 class InvalidStateFileException(Exception): pass
13 class InvalidStateFileException(Exception): pass
@@ -113,8 +113,15 b' class Imerge(object):'
113 wlock = self.repo.wlock()
113 wlock = self.repo.wlock()
114
114
115 (fd, fo) = self.conflicts[fn]
115 (fd, fo) = self.conflicts[fn]
116 p2 = self.wctx.parents()[1]
116 p1, p2 = self.wctx.parents()
117 return merge.filemerge(self.repo, fn, fd, fo, self.wctx, p2)
117 # The filemerge ancestor algorithm does not work if self.wctx
118 # already has two parents (in normal merge it doesn't yet). But
119 # this is very dirty.
120 self.wctx._parents.pop()
121 try:
122 return merge.filemerge(self.repo, fn, fd, fo, self.wctx, p2)
123 finally:
124 self.wctx._parents.append(p2)
118
125
119 def start(self, rev=None):
126 def start(self, rev=None):
120 _filemerge = merge.filemerge
127 _filemerge = merge.filemerge
@@ -269,7 +276,7 b' subcmdtable = {'
269 'unresolve': (unresolve, [])
276 'unresolve': (unresolve, [])
270 }
277 }
271
278
272 def dispatch(im, args, opts):
279 def dispatch_(im, args, opts):
273 def complete(s, choices):
280 def complete(s, choices):
274 candidates = []
281 candidates = []
275 for choice in choices:
282 for choice in choices:
@@ -292,9 +299,9 b' def dispatch(im, args, opts):'
292 args = fancyopts.fancyopts(args, optlist, opts)
299 args = fancyopts.fancyopts(args, optlist, opts)
293 return func(im, *args, **opts)
300 return func(im, *args, **opts)
294 except fancyopts.getopt.GetoptError, inst:
301 except fancyopts.getopt.GetoptError, inst:
295 raise cmdutil.ParseError('imerge', '%s: %s' % (cmd, inst))
302 raise dispatch.ParseError('imerge', '%s: %s' % (cmd, inst))
296 except TypeError:
303 except TypeError:
297 raise cmdutil.ParseError('imerge', _('%s: invalid arguments') % cmd)
304 raise dispatch.ParseError('imerge', _('%s: invalid arguments') % cmd)
298
305
299 def imerge(ui, repo, *args, **opts):
306 def imerge(ui, repo, *args, **opts):
300 '''interactive merge
307 '''interactive merge
@@ -317,6 +324,10 b' def imerge(ui, repo, *args, **opts):'
317
324
318 status:
325 status:
319 show the current state of the merge
326 show the current state of the merge
327 options:
328 -n --no-status: do not print the status prefix
329 --resolved: only print resolved conflicts
330 --unresolved: only print unresolved conflicts
320 next:
331 next:
321 show the next unresolved file merge
332 show the next unresolved file merge
322 merge [<file>]:
333 merge [<file>]:
@@ -353,7 +364,7 b' def imerge(ui, repo, *args, **opts):'
353 if not args:
364 if not args:
354 args = ['merge']
365 args = ['merge']
355
366
356 return dispatch(im, args, opts)
367 return dispatch_(im, args, opts)
357
368
358 cmdtable = {
369 cmdtable = {
359 '^imerge':
370 '^imerge':
General Comments 0
You need to be logged in to leave comments. Login now