##// END OF EJS Templates
simplemerge: support three labels when merging...
Pierre-Yves David -
r22024:372ae274 default
parent child Browse files
Show More
@@ -379,13 +379,16 b' def simplemerge(ui, local, base, other, '
379
379
380 name_a = local
380 name_a = local
381 name_b = other
381 name_b = other
382 name_base = None
382 labels = opts.get('label', [])
383 labels = opts.get('label', [])
383 if len(labels) > 0:
384 if len(labels) > 0:
384 name_a = labels[0]
385 name_a = labels[0]
385 if len(labels) > 1:
386 if len(labels) > 1:
386 name_b = labels[1]
387 name_b = labels[1]
387 if len(labels) > 2:
388 if len(labels) > 2:
388 raise util.Abort(_("can only specify two labels."))
389 name_base = labels[2]
390 if len(labels) > 3:
391 raise util.Abort(_("can only specify three labels."))
389
392
390 try:
393 try:
391 localtext = readfile(local)
394 localtext = readfile(local)
@@ -402,7 +405,11 b' def simplemerge(ui, local, base, other, '
402 out = sys.stdout
405 out = sys.stdout
403
406
404 m3 = Merge3Text(basetext, localtext, othertext)
407 m3 = Merge3Text(basetext, localtext, othertext)
405 for line in m3.merge_lines(name_a=name_a, name_b=name_b):
408 extrakwargs = {}
409 if name_base is not None:
410 extrakwargs['base_marker'] = '|||||||'
411 extrakwargs['name_base'] = name_base
412 for line in m3.merge_lines(name_a=name_a, name_b=name_b, **extrakwargs):
406 out.write(line)
413 out.write(line)
407
414
408 if not opts.get('print'):
415 if not opts.get('print'):
@@ -184,10 +184,25 b' 2 labels'
184 warning: conflicts during merge.
184 warning: conflicts during merge.
185 [1]
185 [1]
186
186
187 3 labels
188
189 $ python simplemerge -p -L foo -L bar -L base conflict-local base conflict-other
190 base
191 <<<<<<< foo
192 not other
193 end
194 ||||||| base
195 =======
196 other
197 end
198 >>>>>>> bar
199 warning: conflicts during merge.
200 [1]
201
187 too many labels
202 too many labels
188
203
189 $ python simplemerge -p -L foo -L bar -L baz conflict-local base conflict-other
204 $ python simplemerge -p -L foo -L bar -L baz -L buz conflict-local base conflict-other
190 abort: can only specify two labels.
205 abort: can only specify three labels.
191 [255]
206 [255]
192
207
193 binary file
208 binary file
General Comments 0
You need to be logged in to leave comments. Login now