Show More
@@ -217,7 +217,7 b' def clean(repo, node, wlock=None, show_s' | |||||
217 |
|
217 | |||
218 | def merge(repo, node, force=None, remind=True, wlock=None): |
|
218 | def merge(repo, node, force=None, remind=True, wlock=None): | |
219 | """branch merge with node, resolving changes""" |
|
219 | """branch merge with node, resolving changes""" | |
220 |
return _merge.update(repo, node, |
|
220 | return _merge.update(repo, node, branchmerge=True, forcemerge=force, | |
221 | remind=remind, wlock=wlock) |
|
221 | remind=remind, wlock=wlock) | |
222 |
|
222 | |||
223 | def revert(repo, node, choose): |
|
223 | def revert(repo, node, choose): |
@@ -47,7 +47,7 b' def merge3(repo, fn, my, other, p1, p2):' | |||||
47 | os.unlink(c) |
|
47 | os.unlink(c) | |
48 | return r |
|
48 | return r | |
49 |
|
49 | |||
50 |
def update(repo, node, |
|
50 | def update(repo, node, branchmerge=False, force=False, choose=None, | |
51 | moddirstate=True, forcemerge=False, wlock=None, show_stats=True, |
|
51 | moddirstate=True, forcemerge=False, wlock=None, show_stats=True, | |
52 | remind=True): |
|
52 | remind=True): | |
53 | pl = repo.dirstate.parents() |
|
53 | pl = repo.dirstate.parents() | |
@@ -74,10 +74,10 b' def update(repo, node, allow=False, forc' | |||||
74 | # from p1 to p2? |
|
74 | # from p1 to p2? | |
75 | linear_path = (pa == p1 or pa == p2) |
|
75 | linear_path = (pa == p1 or pa == p2) | |
76 |
|
76 | |||
77 |
if |
|
77 | if branchmerge and linear_path: | |
78 | raise util.Abort(_("there is nothing to merge, just use " |
|
78 | raise util.Abort(_("there is nothing to merge, just use " | |
79 | "'hg update' or look at 'hg heads'")) |
|
79 | "'hg update' or look at 'hg heads'")) | |
80 |
if |
|
80 | if branchmerge and not forcemerge: | |
81 | if modified or added or removed: |
|
81 | if modified or added or removed: | |
82 | raise util.Abort(_("outstanding uncommitted changes")) |
|
82 | raise util.Abort(_("outstanding uncommitted changes")) | |
83 |
|
83 | |||
@@ -93,8 +93,8 b' def update(repo, node, allow=False, forc' | |||||
93 | # resolve the manifest to determine which files |
|
93 | # resolve the manifest to determine which files | |
94 | # we care about merging |
|
94 | # we care about merging | |
95 | repo.ui.note(_("resolving manifests\n")) |
|
95 | repo.ui.note(_("resolving manifests\n")) | |
96 |
repo.ui.debug(_(" force %s |
|
96 | repo.ui.debug(_(" force %s branchmerge %s moddirstate %s linear %s\n") % | |
97 |
(force, |
|
97 | (force, branchmerge, moddirstate, linear_path)) | |
98 | repo.ui.debug(_(" ancestor %s local %s remote %s\n") % |
|
98 | repo.ui.debug(_(" ancestor %s local %s remote %s\n") % | |
99 | (short(man), short(m1n), short(m2n))) |
|
99 | (short(man), short(m1n), short(m2n))) | |
100 |
|
100 | |||
@@ -180,7 +180,7 b' def update(repo, node, allow=False, forc' | |||||
180 | elif f in ma: |
|
180 | elif f in ma: | |
181 | if n != ma[f]: |
|
181 | if n != ma[f]: | |
182 | r = _("d") |
|
182 | r = _("d") | |
183 |
if not force and (linear_path or |
|
183 | if not force and (linear_path or branchmerge): | |
184 | r = repo.ui.prompt( |
|
184 | r = repo.ui.prompt( | |
185 | (_(" local changed %s which remote deleted\n") % f) + |
|
185 | (_(" local changed %s which remote deleted\n") % f) + | |
186 | _("(k)eep or (d)elete?"), _("[kd]"), _("k")) |
|
186 | _("(k)eep or (d)elete?"), _("[kd]"), _("k")) | |
@@ -210,7 +210,7 b' def update(repo, node, allow=False, forc' | |||||
210 | continue |
|
210 | continue | |
211 | if f in ma and n != ma[f]: |
|
211 | if f in ma and n != ma[f]: | |
212 | r = _("k") |
|
212 | r = _("k") | |
213 |
if not force and (linear_path or |
|
213 | if not force and (linear_path or branchmerge): | |
214 | r = repo.ui.prompt( |
|
214 | r = repo.ui.prompt( | |
215 | (_("remote changed %s which local deleted\n") % f) + |
|
215 | (_("remote changed %s which local deleted\n") % f) + | |
216 | _("(k)eep or (d)elete?"), _("[kd]"), _("k")) |
|
216 | _("(k)eep or (d)elete?"), _("[kd]"), _("k")) | |
@@ -235,10 +235,9 b' def update(repo, node, allow=False, forc' | |||||
235 |
|
235 | |||
236 | if linear_path or force: |
|
236 | if linear_path or force: | |
237 | # we don't need to do any magic, just jump to the new rev |
|
237 | # we don't need to do any magic, just jump to the new rev | |
238 | branch_merge = False |
|
|||
239 | p1, p2 = p2, nullid |
|
238 | p1, p2 = p2, nullid | |
240 | else: |
|
239 | else: | |
241 |
if not |
|
240 | if not branchmerge: | |
242 | repo.ui.status(_("this update spans a branch" |
|
241 | repo.ui.status(_("this update spans a branch" | |
243 | " affecting the following files:\n")) |
|
242 | " affecting the following files:\n")) | |
244 | fl = merge.keys() + get.keys() |
|
243 | fl = merge.keys() + get.keys() | |
@@ -252,7 +251,6 b' def update(repo, node, allow=False, forc' | |||||
252 | repo.ui.status(_("(use 'hg merge' to merge across branches" |
|
251 | repo.ui.status(_("(use 'hg merge' to merge across branches" | |
253 | " or 'hg update -C' to lose changes)\n")) |
|
252 | " or 'hg update -C' to lose changes)\n")) | |
254 | return 1 |
|
253 | return 1 | |
255 | branch_merge = True |
|
|||
256 |
|
254 | |||
257 | xp1 = hex(p1) |
|
255 | xp1 = hex(p1) | |
258 | xp2 = hex(p2) |
|
256 | xp2 = hex(p2) | |
@@ -272,7 +270,7 b' def update(repo, node, allow=False, forc' | |||||
272 | repo.wwrite(f, t) |
|
270 | repo.wwrite(f, t) | |
273 | util.set_exec(repo.wjoin(f), mf2[f]) |
|
271 | util.set_exec(repo.wjoin(f), mf2[f]) | |
274 | if moddirstate: |
|
272 | if moddirstate: | |
275 |
if branch |
|
273 | if branchmerge: | |
276 | repo.dirstate.update([f], 'n', st_mtime=-1) |
|
274 | repo.dirstate.update([f], 'n', st_mtime=-1) | |
277 | else: |
|
275 | else: | |
278 | repo.dirstate.update([f], 'n') |
|
276 | repo.dirstate.update([f], 'n') | |
@@ -290,7 +288,7 b' def update(repo, node, allow=False, forc' | |||||
290 | failedmerge.append(f) |
|
288 | failedmerge.append(f) | |
291 | util.set_exec(repo.wjoin(f), flag) |
|
289 | util.set_exec(repo.wjoin(f), flag) | |
292 | if moddirstate: |
|
290 | if moddirstate: | |
293 |
if branch |
|
291 | if branchmerge: | |
294 | # We've done a branch merge, mark this file as merged |
|
292 | # We've done a branch merge, mark this file as merged | |
295 | # so that we properly record the merger later |
|
293 | # so that we properly record the merger later | |
296 | repo.dirstate.update([f], 'm') |
|
294 | repo.dirstate.update([f], 'm') | |
@@ -314,7 +312,7 b' def update(repo, node, allow=False, forc' | |||||
314 | repo.ui.warn(_("update failed to remove %s: %s!\n") % |
|
312 | repo.ui.warn(_("update failed to remove %s: %s!\n") % | |
315 | (f, inst.strerror)) |
|
313 | (f, inst.strerror)) | |
316 | if moddirstate: |
|
314 | if moddirstate: | |
317 |
if branch |
|
315 | if branchmerge: | |
318 | repo.dirstate.update(remove, 'r') |
|
316 | repo.dirstate.update(remove, 'r') | |
319 | else: |
|
317 | else: | |
320 | repo.dirstate.forget(remove) |
|
318 | repo.dirstate.forget(remove) | |
@@ -330,7 +328,7 b' def update(repo, node, allow=False, forc' | |||||
330 | note = ", ".join([_("%d files %s") % s for s in stats]) |
|
328 | note = ", ".join([_("%d files %s") % s for s in stats]) | |
331 | repo.ui.status("%s\n" % note) |
|
329 | repo.ui.status("%s\n" % note) | |
332 | if moddirstate: |
|
330 | if moddirstate: | |
333 |
if branch |
|
331 | if branchmerge: | |
334 | if failedmerge: |
|
332 | if failedmerge: | |
335 | repo.ui.status(_("There are unresolved merges," |
|
333 | repo.ui.status(_("There are unresolved merges," | |
336 | " you can redo the full merge using:\n" |
|
334 | " you can redo the full merge using:\n" |
General Comments 0
You need to be logged in to leave comments.
Login now