59 |
59 |
60 returns a tuple (bool, newnode) where, |
60 returns a tuple (bool, newnode) where, |
61 bool: a boolean value indicating whether the instability was solved |
61 bool: a boolean value indicating whether the instability was solved |
62 newnode: if bool is True, then the newnode of the resultant commit |
62 newnode: if bool is True, then the newnode of the resultant commit |
63 formed. newnode can be node, when resolution led to no new |
63 formed. newnode can be node, when resolution led to no new |
64 commit. If bool is False, this is ''. |
64 commit. If bool is False, this is ".". |
65 """ |
65 """ |
66 displayer = None |
66 displayer = None |
67 if stacktmplt: |
67 if stacktmplt: |
68 displayer = compat.changesetdisplayer(ui, repo, |
68 displayer = compat.changesetdisplayer(ui, repo, |
69 {'template': stacktemplate}) |
69 {'template': stacktemplate}) |
99 |
99 |
100 returns a tuple (bool, newnode) where, |
100 returns a tuple (bool, newnode) where, |
101 bool: a boolean value indicating whether the instability was solved |
101 bool: a boolean value indicating whether the instability was solved |
102 newnode: if bool is True, then the newnode of the resultant commit |
102 newnode: if bool is True, then the newnode of the resultant commit |
103 formed. newnode can be node, when resolution led to no new |
103 formed. newnode can be node, when resolution led to no new |
104 commit. If bool is False, this is ''. |
104 commit. If bool is False, this is ".". |
105 """ |
105 """ |
106 pctx = orig.p1() |
106 pctx = orig.p1() |
107 keepbranch = orig.p1().branch() != orig.branch() |
107 keepbranch = orig.p1().branch() != orig.branch() |
108 if len(orig.parents()) == 2: |
108 if len(orig.parents()) == 2: |
109 p1obs = orig.p1().obsolete() |
109 p1obs = orig.p1().obsolete() |
123 pctx = orig.p2() |
123 pctx = orig.p2() |
124 keepbranch = orig.p2().branch() != orig.branch() |
124 keepbranch = orig.p2().branch() != orig.branch() |
125 |
125 |
126 if not pctx.obsolete(): |
126 if not pctx.obsolete(): |
127 ui.warn(_("cannot solve instability of %s, skipping\n") % orig) |
127 ui.warn(_("cannot solve instability of %s, skipping\n") % orig) |
128 return (False, '') |
128 return (False, ".") |
129 obs = pctx |
129 obs = pctx |
130 newer = obsutil.successorssets(repo, obs.node()) |
130 newer = obsutil.successorssets(repo, obs.node()) |
131 # search of a parent which is not killed |
131 # search of a parent which is not killed |
132 while not newer or newer == [()]: |
132 while not newer or newer == [()]: |
133 ui.debug("stabilize target %s is plain dead," |
133 ui.debug("stabilize target %s is plain dead," |
137 newer = obsutil.successorssets(repo, obs.node()) |
137 newer = obsutil.successorssets(repo, obs.node()) |
138 if len(newer) > 1: |
138 if len(newer) > 1: |
139 msg = _("skipping %s: divergent rewriting. can't choose " |
139 msg = _("skipping %s: divergent rewriting. can't choose " |
140 "destination\n") % obs |
140 "destination\n") % obs |
141 ui.write_err(msg) |
141 ui.write_err(msg) |
142 return (False, '') |
142 return (False, ".") |
143 targets = newer[0] |
143 targets = newer[0] |
144 assert targets |
144 assert targets |
145 if len(targets) > 1: |
145 if len(targets) > 1: |
146 # split target, figure out which one to pick, are they all in line? |
146 # split target, figure out which one to pick, are they all in line? |
147 targetrevs = [repo[r].rev() for r in targets] |
147 targetrevs = [repo[r].rev() for r in targets] |
155 if selectedrev is None: |
155 if selectedrev is None: |
156 msg = _("could not solve instability, " |
156 msg = _("could not solve instability, " |
157 "ambiguous destination: " |
157 "ambiguous destination: " |
158 "parent split across two branches\n") |
158 "parent split across two branches\n") |
159 ui.write_err(msg) |
159 ui.write_err(msg) |
160 return (False, '') |
160 return (False, ".") |
161 target = repo[selectedrev] |
161 target = repo[selectedrev] |
162 else: |
162 else: |
163 target = repo[heads.first()] |
163 target = repo[heads.first()] |
164 else: |
164 else: |
165 target = targets[0] |
165 target = targets[0] |
199 |
199 |
200 returns a tuple (bool, newnode) where, |
200 returns a tuple (bool, newnode) where, |
201 bool: a boolean value indicating whether the instability was solved |
201 bool: a boolean value indicating whether the instability was solved |
202 newnode: if bool is True, then the newnode of the resultant commit |
202 newnode: if bool is True, then the newnode of the resultant commit |
203 formed. newnode can be node, when resolution led to no new |
203 formed. newnode can be node, when resolution led to no new |
204 commit. If bool is False, this is ''. |
204 commit. If bool is False, this is ".". |
205 """ |
205 """ |
206 repo = repo.unfiltered() |
206 repo = repo.unfiltered() |
207 bumped = repo[bumped.rev()] |
207 bumped = repo[bumped.rev()] |
208 # For now we deny bumped merge |
208 # For now we deny bumped merge |
209 if len(bumped.parents()) > 1: |
209 if len(bumped.parents()) > 1: |
210 msg = _('skipping %s : we do not handle merge yet\n') % bumped |
210 msg = _('skipping %s : we do not handle merge yet\n') % bumped |
211 ui.write_err(msg) |
211 ui.write_err(msg) |
212 return (False, '') |
212 return (False, ".") |
213 prec = repo.set('last(allprecursors(%d) and public())', bumped.rev()).next() |
213 prec = repo.set('last(allprecursors(%d) and public())', bumped.rev()).next() |
214 # For now we deny target merge |
214 # For now we deny target merge |
215 if len(prec.parents()) > 1: |
215 if len(prec.parents()) > 1: |
216 msg = _('skipping: %s: public version is a merge, ' |
216 msg = _('skipping: %s: public version is a merge, ' |
217 'this is not handled yet\n') % prec |
217 'this is not handled yet\n') % prec |
218 ui.write_err(msg) |
218 ui.write_err(msg) |
219 return (False, '') |
219 return (False, ".") |
220 |
220 |
221 if not ui.quiet or confirm: |
221 if not ui.quiet or confirm: |
222 repo.ui.write(_('recreate:'), label='evolve.operation') |
222 repo.ui.write(_('recreate:'), label='evolve.operation') |
223 displayer.show(bumped) |
223 displayer.show(bumped) |
224 repo.ui.write(_('atop:')) |
224 repo.ui.write(_('atop:')) |
230 repo.ui.write(todo) |
230 repo.ui.write(todo) |
231 repo.ui.write(('hg update %s;\n' % prec)) |
231 repo.ui.write(('hg update %s;\n' % prec)) |
232 repo.ui.write(('hg revert --all --rev %s;\n' % bumped)) |
232 repo.ui.write(('hg revert --all --rev %s;\n' % bumped)) |
233 repo.ui.write(('hg commit --msg "%s update to %s"\n' % |
233 repo.ui.write(('hg commit --msg "%s update to %s"\n' % |
234 (TROUBLES['PHASEDIVERGENT'], bumped))) |
234 (TROUBLES['PHASEDIVERGENT'], bumped))) |
235 return (False, '') |
235 return (False, ".") |
236 if progresscb: |
236 if progresscb: |
237 progresscb() |
237 progresscb() |
238 tmpctx = bumped |
238 tmpctx = bumped |
239 |
239 |
240 # Checking for whether the phase-divergent changeset has common parents as |
240 # Checking for whether the phase-divergent changeset has common parents as |
341 |
341 |
342 returns a tuple (bool, newnode) where, |
342 returns a tuple (bool, newnode) where, |
343 bool: a boolean value indicating whether the instability was solved |
343 bool: a boolean value indicating whether the instability was solved |
344 newnode: if bool is True, then the newnode of the resultant commit |
344 newnode: if bool is True, then the newnode of the resultant commit |
345 formed. newnode can be node, when resolution led to no new |
345 formed. newnode can be node, when resolution led to no new |
346 commit. If bool is False, this is ''. |
346 commit. If bool is False, this is ".". |
347 """ |
347 """ |
348 repo = repo.unfiltered() |
348 repo = repo.unfiltered() |
349 divergent = repo[divergent.rev()] |
349 divergent = repo[divergent.rev()] |
350 evolvestate['divergent'] = divergent.node() |
350 evolvestate['divergent'] = divergent.node() |
351 # sometimes we will relocate a node in case of different parents and we can |
351 # sometimes we will relocate a node in case of different parents and we can |
374 "| - hg prune\n" |
374 "| - hg prune\n" |
375 "| \n" |
375 "| \n" |
376 "| You should contact your local evolution Guru for help.\n" |
376 "| You should contact your local evolution Guru for help.\n" |
377 ) % (divergent, TROUBLES['CONTENTDIVERGENT'], othersstr) |
377 ) % (divergent, TROUBLES['CONTENTDIVERGENT'], othersstr) |
378 ui.write_err(msg) |
378 ui.write_err(msg) |
379 return (False, '') |
379 return (False, ".") |
380 other = others[0] |
380 other = others[0] |
381 evolvestate['other-divergent'] = other.node() |
381 evolvestate['other-divergent'] = other.node() |
382 evolvestate['base'] = base.node() |
382 evolvestate['base'] = base.node() |
383 |
383 |
384 # we don't handle merge content-divergent changesets yet |
384 # we don't handle merge content-divergent changesets yet |
388 ui.write_err(msg) |
388 ui.write_err(msg) |
389 hint = _("You have to fallback to solving this by hand...\n" |
389 hint = _("You have to fallback to solving this by hand...\n" |
390 "| This probably means redoing the merge and using \n" |
390 "| This probably means redoing the merge and using \n" |
391 "| `hg prune` to kill older version.\n") |
391 "| `hg prune` to kill older version.\n") |
392 ui.write_err(hint) |
392 ui.write_err(hint) |
393 return (False, '') |
393 return (False, ".") |
394 |
394 |
395 otherp1 = other.p1().rev() |
395 otherp1 = other.p1().rev() |
396 divp1 = divergent.p1().rev() |
396 divp1 = divergent.p1().rev() |
397 |
397 |
398 # finding single successors of otherp1 and divp1 |
398 # finding single successors of otherp1 and divp1 |
448 "| - either: hg rebase --dest 'p1(%(d)s)' -r %(o)s\n" |
448 "| - either: hg rebase --dest 'p1(%(d)s)' -r %(o)s\n" |
449 "| - or: hg rebase --dest 'p1(%(o)s)' -r %(d)s\n" |
449 "| - or: hg rebase --dest 'p1(%(o)s)' -r %(d)s\n" |
450 ) % {'d': divergent, 'o': other} |
450 ) % {'d': divergent, 'o': other} |
451 ui.write_err(msg) |
451 ui.write_err(msg) |
452 ui.write_err(hint) |
452 ui.write_err(hint) |
453 return (False, '') |
453 return (False, ".") |
454 |
454 |
455 if not ui.quiet or confirm: |
455 if not ui.quiet or confirm: |
456 ui.write(_('merge:'), label='evolve.operation') |
456 ui.write(_('merge:'), label='evolve.operation') |
457 displayer.show(divergent) |
457 displayer.show(divergent) |
458 ui.write(_('with: ')) |
458 ui.write(_('with: ')) |
468 '%s and %s"&&\n' % (divergent, other))) |
468 '%s and %s"&&\n' % (divergent, other))) |
469 ui.write(('hg up -C %s &&\n' % base)) |
469 ui.write(('hg up -C %s &&\n' % base)) |
470 ui.write(('hg revert --all --rev tip &&\n')) |
470 ui.write(('hg revert --all --rev tip &&\n')) |
471 ui.write(('hg commit -m "`hg log -r %s --template={desc}`";\n' |
471 ui.write(('hg commit -m "`hg log -r %s --template={desc}`";\n' |
472 % divergent)) |
472 % divergent)) |
473 return (False, '') |
473 return (False, ".") |
474 |
474 |
475 evolvestate['resolutionparent'] = resolutionparent |
475 evolvestate['resolutionparent'] = resolutionparent |
476 # relocate the other divergent if required |
476 # relocate the other divergent if required |
477 if relocatereq: |
477 if relocatereq: |
478 # relocating will help us understand during the time of conflicts that |
478 # relocating will help us understand during the time of conflicts that |