1025 |
1026 |
1026 @eh.extsetup |
1027 @eh.extsetup |
1027 def deprecatealiases(ui): |
1028 def deprecatealiases(ui): |
1028 _deprecatealias('gup', 'next') |
1029 _deprecatealias('gup', 'next') |
1029 _deprecatealias('gdown', 'previous') |
1030 _deprecatealias('gdown', 'previous') |
1030 |
|
1031 def _solveone(ui, repo, ctx, dryrun, confirm, progresscb, category): |
|
1032 """Resolve the troubles affecting one revision |
|
1033 |
|
1034 returns a tuple (bool, newnode) where, |
|
1035 bool: a boolean value indicating whether the instability was solved |
|
1036 newnode: if bool is True, then the newnode of the resultant commit |
|
1037 formed. newnode can be node, when resolution led to no new |
|
1038 commit. If bool is False, this is ''. |
|
1039 """ |
|
1040 wlock = lock = tr = None |
|
1041 try: |
|
1042 wlock = repo.wlock() |
|
1043 lock = repo.lock() |
|
1044 tr = repo.transaction("evolve") |
|
1045 if 'orphan' == category: |
|
1046 result = _solveunstable(ui, repo, ctx, dryrun, confirm, progresscb) |
|
1047 elif 'phasedivergent' == category: |
|
1048 result = _solvebumped(ui, repo, ctx, dryrun, confirm, progresscb) |
|
1049 elif 'contentdivergent' == category: |
|
1050 result = _solvedivergent(ui, repo, ctx, dryrun, confirm, |
|
1051 progresscb) |
|
1052 else: |
|
1053 assert False, "unknown trouble category: %s" % (category) |
|
1054 tr.close() |
|
1055 return result |
|
1056 finally: |
|
1057 lockmod.release(tr, lock, wlock) |
|
1058 |
1031 |
1059 def _handlenotrouble(ui, repo, allopt, revopt, anyopt, targetcat): |
1032 def _handlenotrouble(ui, repo, allopt, revopt, anyopt, targetcat): |
1060 """Used by the evolve function to display an error message when |
1033 """Used by the evolve function to display an error message when |
1061 no troubles can be resolved""" |
1034 no troubles can be resolved""" |
1062 troublecategories = ['phasedivergent', 'contentdivergent', 'orphan'] |
1035 troublecategories = ['phasedivergent', 'contentdivergent', 'orphan'] |
1625 if targetcat == 'orphan': |
1598 if targetcat == 'orphan': |
1626 revs = _orderrevs(repo, revs) |
1599 revs = _orderrevs(repo, revs) |
1627 for rev in revs: |
1600 for rev in revs: |
1628 curctx = repo[rev] |
1601 curctx = repo[rev] |
1629 progresscb() |
1602 progresscb() |
1630 ret = _solveone(ui, repo, curctx, dryrunopt, confirmopt, |
1603 ret = evolvecmd._solveone(ui, repo, curctx, dryrunopt, confirmopt, |
1631 progresscb, targetcat) |
1604 progresscb, targetcat) |
1632 seen += 1 |
1605 seen += 1 |
1633 if ret[0]: |
1606 if ret[0]: |
1634 replacements[curctx.node()] = [ret[1]] |
1607 replacements[curctx.node()] = [ret[1]] |
1635 progresscb() |
1608 progresscb() |
1636 _cleanup(ui, repo, startnode, showprogress) |
1609 _cleanup(ui, repo, startnode, showprogress) |
2280 displayer.show(repo[c]) |
2253 displayer.show(repo[c]) |
2281 ui.warn(_("(run 'hg evolve --rev REV' on one of them)\n")) |
2254 ui.warn(_("(run 'hg evolve --rev REV' on one of them)\n")) |
2282 return 1 |
2255 return 1 |
2283 else: |
2256 else: |
2284 cmdutil.bailifchanged(repo) |
2257 cmdutil.bailifchanged(repo) |
2285 result = _solveone(ui, repo, repo[aspchildren[0]], dryrunopt, |
2258 result = evolvecmd._solveone(ui, repo, repo[aspchildren[0]], |
2286 False, lambda: None, category='orphan') |
2259 dryrunopt, False, lambda: None, |
|
2260 category='orphan') |
2287 # making sure a next commit is formed |
2261 # making sure a next commit is formed |
2288 if result[0] and result[1]: |
2262 if result[0] and result[1]: |
2289 ui.status(_('working directory now at %s\n') |
2263 ui.status(_('working directory now at %s\n') |
2290 % ui.label(str(repo['.']), 'evolve.node')) |
2264 % ui.label(str(repo['.']), 'evolve.node')) |
2291 return 0 |
2265 return 0 |