##// END OF EJS Templates
simplemerge: enable option to resolve conflicts one way...
Jordi Gutiérrez Hermoso -
r26223:ed12abab default
parent child Browse files
Show More
@@ -90,7 +90,8 b' class Merge3Text(object):'
90 start_marker='<<<<<<<',
90 start_marker='<<<<<<<',
91 mid_marker='=======',
91 mid_marker='=======',
92 end_marker='>>>>>>>',
92 end_marker='>>>>>>>',
93 base_marker=None):
93 base_marker=None,
94 localorother=None):
94 """Return merge in cvs-like form.
95 """Return merge in cvs-like form.
95 """
96 """
96 self.conflicts = False
97 self.conflicts = False
@@ -119,21 +120,28 b' class Merge3Text(object):'
119 for i in range(t[1], t[2]):
120 for i in range(t[1], t[2]):
120 yield self.b[i]
121 yield self.b[i]
121 elif what == 'conflict':
122 elif what == 'conflict':
122 self.conflicts = True
123 if localorother == 'local':
123 if start_marker is not None:
124 for i in range(t[3], t[4]):
124 yield start_marker + newline
125 yield self.a[i]
125 for i in range(t[3], t[4]):
126 elif localorother == 'other':
126 yield self.a[i]
127 for i in range(t[5], t[6]):
127 if base_marker is not None:
128 yield self.b[i]
128 yield base_marker + newline
129 else:
129 for i in range(t[1], t[2]):
130 self.conflicts = True
130 yield self.base[i]
131 if start_marker is not None:
131 if mid_marker is not None:
132 yield start_marker + newline
132 yield mid_marker + newline
133 for i in range(t[3], t[4]):
133 for i in range(t[5], t[6]):
134 yield self.a[i]
134 yield self.b[i]
135 if base_marker is not None:
135 if end_marker is not None:
136 yield base_marker + newline
136 yield end_marker + newline
137 for i in range(t[1], t[2]):
138 yield self.base[i]
139 if mid_marker is not None:
140 yield mid_marker + newline
141 for i in range(t[5], t[6]):
142 yield self.b[i]
143 if end_marker is not None:
144 yield end_marker + newline
137 else:
145 else:
138 raise ValueError(what)
146 raise ValueError(what)
139
147
@@ -390,7 +398,7 b' def simplemerge(ui, local, base, other, '
390 out = sys.stdout
398 out = sys.stdout
391
399
392 m3 = Merge3Text(basetext, localtext, othertext)
400 m3 = Merge3Text(basetext, localtext, othertext)
393 extrakwargs = {}
401 extrakwargs = {"localorother": opts.get("localorother", None)}
394 if mode == 'union':
402 if mode == 'union':
395 extrakwargs['start_marker'] = None
403 extrakwargs['start_marker'] = None
396 extrakwargs['mid_marker'] = None
404 extrakwargs['mid_marker'] = None
General Comments 0
You need to be logged in to leave comments. Login now