hgext3rd/evolve/__init__.py
changeset 3386 2a51107e60cf
parent 3385 823031b51d81
child 3388 be41e4740a25
equal deleted inserted replaced
3385:823031b51d81 3386:2a51107e60cf
  1515     You can also use the evolve command to list the troubles affecting your
  1515     You can also use the evolve command to list the troubles affecting your
  1516     repository by using the --list flag. You can choose to display only some
  1516     repository by using the --list flag. You can choose to display only some
  1517     categories of troubles with the --unstable, --divergent or --bumped flags.
  1517     categories of troubles with the --unstable, --divergent or --bumped flags.
  1518     """
  1518     """
  1519 
  1519 
       
  1520     opts = _checkevolveopts(repo, opts)
  1520     # Options
  1521     # Options
  1521     listopt = opts['list']
       
  1522     contopt = opts['continue']
  1522     contopt = opts['continue']
  1523     anyopt = opts['any']
  1523     anyopt = opts['any']
  1524     allopt = opts['all']
  1524     allopt = opts['all']
  1525     startnode = repo['.']
  1525     startnode = repo['.']
  1526     dryrunopt = opts['dry_run']
  1526     dryrunopt = opts['dry_run']
  1527     confirmopt = opts['confirm']
  1527     confirmopt = opts['confirm']
  1528     revopt = opts['rev']
  1528     revopt = opts['rev']
  1529 
  1529 
  1530     # Backward compatibility
       
  1531     if opts['unstable']:
       
  1532         msg = ("'evolve --unstable' is deprecated, "
       
  1533                "use 'evolve --orphan'")
       
  1534         repo.ui.deprecwarn(msg, '4.4')
       
  1535 
       
  1536         opts['orphan'] = opts['divergent']
       
  1537 
       
  1538     if opts['divergent']:
       
  1539         msg = ("'evolve --divergent' is deprecated, "
       
  1540                "use 'evolve --content-divergent'")
       
  1541         repo.ui.deprecwarn(msg, '4.4')
       
  1542 
       
  1543         opts['content_divergent'] = opts['divergent']
       
  1544 
       
  1545     if opts['bumped']:
       
  1546         msg = ("'evolve --bumped' is deprecated, "
       
  1547                "use 'evolve --phase-divergent'")
       
  1548         repo.ui.deprecwarn(msg, '4.4')
       
  1549 
       
  1550         opts['phase_divergent'] = opts['bumped']
       
  1551 
       
  1552     troublecategories = ['phase_divergent', 'content_divergent', 'orphan']
  1530     troublecategories = ['phase_divergent', 'content_divergent', 'orphan']
  1553     specifiedcategories = [t.replace('_', '')
  1531     specifiedcategories = [t.replace('_', '')
  1554                            for t in troublecategories
  1532                            for t in troublecategories
  1555                            if opts[t]]
  1533                            if opts[t]]
  1556     if listopt:
  1534     if opts['list']:
  1557         compat.startpager(ui, 'evolve')
  1535         compat.startpager(ui, 'evolve')
  1558         listtroubles(ui, repo, specifiedcategories, **opts)
  1536         listtroubles(ui, repo, specifiedcategories, **opts)
  1559         return
  1537         return
  1560 
  1538 
  1561     targetcat = 'orphan'
  1539     targetcat = 'orphan'
  1600         if revopt or allopt:
  1578         if revopt or allopt:
  1601             ui.progress(_('evolve'), seen, unit=_('changesets'), total=count)
  1579             ui.progress(_('evolve'), seen, unit=_('changesets'), total=count)
  1602 
  1580 
  1603     # Continuation handling
  1581     # Continuation handling
  1604     if contopt:
  1582     if contopt:
  1605         if anyopt:
       
  1606             raise error.Abort('cannot specify both "--any" and "--continue"')
       
  1607         if allopt:
       
  1608             raise error.Abort('cannot specify both "--all" and "--continue"')
       
  1609         state = _evolvestateread(repo)
  1583         state = _evolvestateread(repo)
  1610         if state is None:
  1584         if state is None:
  1611             raise error.Abort('no evolve to continue')
  1585             raise error.Abort('no evolve to continue')
  1612         orig = repo[state['current']]
  1586         orig = repo[state['current']]
  1613         with repo.wlock(), repo.lock():
  1587         with repo.wlock(), repo.lock():
  1630             _evolvestatedelete(repo)
  1604             _evolvestatedelete(repo)
  1631             return
  1605             return
  1632 
  1606 
  1633     cmdutil.bailifchanged(repo)
  1607     cmdutil.bailifchanged(repo)
  1634 
  1608 
  1635     if revopt and allopt:
       
  1636         raise error.Abort('cannot specify both "--rev" and "--all"')
       
  1637     if revopt and anyopt:
       
  1638         raise error.Abort('cannot specify both "--rev" and "--any"')
       
  1639 
       
  1640     revs = _selectrevs(repo, allopt, revopt, anyopt, targetcat)
  1609     revs = _selectrevs(repo, allopt, revopt, anyopt, targetcat)
  1641 
  1610 
  1642     if not revs:
  1611     if not revs:
  1643         return _handlenotrouble(ui, repo, allopt, revopt, anyopt, targetcat)
  1612         return _handlenotrouble(ui, repo, allopt, revopt, anyopt, targetcat)
  1644 
  1613 
  1652         _solveone(ui, repo, repo[rev], dryrunopt, confirmopt,
  1621         _solveone(ui, repo, repo[rev], dryrunopt, confirmopt,
  1653                   progresscb, targetcat)
  1622                   progresscb, targetcat)
  1654         seen += 1
  1623         seen += 1
  1655     progresscb()
  1624     progresscb()
  1656     _cleanup(ui, repo, startnode, showprogress)
  1625     _cleanup(ui, repo, startnode, showprogress)
       
  1626 
       
  1627 def _checkevolveopts(repo, opts):
       
  1628     """ check the options passed to `hg evolve` and warn for deprecation warning
       
  1629     if any """
       
  1630 
       
  1631     if opts['continue']:
       
  1632         if opts['any']:
       
  1633             raise error.Abort('cannot specify both "--any" and "--continue"')
       
  1634         if opts['all']:
       
  1635             raise error.Abort('cannot specify both "--all" and "--continue"')
       
  1636 
       
  1637     if opts['rev']:
       
  1638         if opts['any']:
       
  1639             raise error.Abort('cannot specify both "--rev" and "--any"')
       
  1640         if opts['all']:
       
  1641             raise error.Abort('cannot specify both "--rev" and "--all"')
       
  1642 
       
  1643     # Backward compatibility
       
  1644     if opts['unstable']:
       
  1645         msg = ("'evolve --unstable' is deprecated, "
       
  1646                "use 'evolve --orphan'")
       
  1647         repo.ui.deprecwarn(msg, '4.4')
       
  1648 
       
  1649         opts['orphan'] = opts['divergent']
       
  1650 
       
  1651     if opts['divergent']:
       
  1652         msg = ("'evolve --divergent' is deprecated, "
       
  1653                "use 'evolve --content-divergent'")
       
  1654         repo.ui.deprecwarn(msg, '4.4')
       
  1655 
       
  1656         opts['content_divergent'] = opts['divergent']
       
  1657 
       
  1658     if opts['bumped']:
       
  1659         msg = ("'evolve --bumped' is deprecated, "
       
  1660                "use 'evolve --phase-divergent'")
       
  1661         repo.ui.deprecwarn(msg, '4.4')
       
  1662 
       
  1663         opts['phase_divergent'] = opts['bumped']
       
  1664 
       
  1665     return opts
  1657 
  1666 
  1658 def _possibledestination(repo, rev):
  1667 def _possibledestination(repo, rev):
  1659     """return all changesets that may be a new parent for REV"""
  1668     """return all changesets that may be a new parent for REV"""
  1660     tonode = repo.changelog.node
  1669     tonode = repo.changelog.node
  1661     parents = repo.changelog.parentrevs
  1670     parents = repo.changelog.parentrevs