hgext/evolve.py
branchstable
changeset 891 36c1c80e99a3
parent 867 6a67606e1c34
child 892 947fb5b1915b
equal deleted inserted replaced
867:6a67606e1c34 891:36c1c80e99a3
    17     - alters core commands and extensions that rewrite history to use
    17     - alters core commands and extensions that rewrite history to use
    18       this feature,
    18       this feature,
    19     - improves some aspect of the early implementation in 2.3
    19     - improves some aspect of the early implementation in 2.3
    20 '''
    20 '''
    21 
    21 
    22 testedwith = '2.7 2.7.1 2.7.2 2.8 2.8.1'
    22 testedwith = '2.7 2.7.1 2.7.2 2.8 2.8.1 2.9.2'
    23 buglink = 'https://bitbucket.org/marmoute/mutable-history/issues'
    23 buglink = 'https://bitbucket.org/marmoute/mutable-history/issues'
    24 
    24 
    25 import sys
    25 import sys
    26 import random
    26 import random
    27 
    27 
   812      _('record the specified user in metadata'), _('USER')),
   812      _('record the specified user in metadata'), _('USER')),
   813 ]
   813 ]
   814 
   814 
   815 
   815 
   816 @command('^evolve|stabilize|solve',
   816 @command('^evolve|stabilize|solve',
   817     [('n', 'dry-run', False, 'do not perform actions, print what to be done'),
   817     [('n', 'dry-run', False, 'do not perform actions, just print what would be done'),
   818     ('A', 'any', False, 'evolve any troubled changeset'),
   818     ('A', 'any', False, 'evolve any troubled changeset'),
   819     ('a', 'all', False, 'evolve all troubled changesets'),
   819     ('a', 'all', False, 'evolve all troubled changesets'),
   820     ('c', 'continue', False, 'continue an interrupted evolution'), ],
   820     ('c', 'continue', False, 'continue an interrupted evolution'), ],
   821     _('[OPTIONS]...'))
   821     _('[OPTIONS]...'))
   822 def evolve(ui, repo, **opts):
   822 def evolve(ui, repo, **opts):
   823     """Solve trouble in your repository
   823     """Solve trouble in your repository
   824 
   824 
   825     - rebase unstable changeset to make it stable again,
   825     - rebase unstable changesets to make them stable again,
   826     - create proper diff from bumped changeset,
   826     - create proper diffs from bumped changesets,
   827     - merge divergent changesets.
   827     - merge divergent changesets,
   828     - update to a successor if the working directory parent is
   828     - update to a successor if the working directory parent is
   829       obsolete
   829       obsolete
   830 
   830 
   831     By default, take the first trouble changeset that looks relevant.
   831     By default, takes the first troubled changeset that looks relevant.
   832 
   832 
   833     (The logic is still a bit fuzzy)
   833     (The logic is still a bit fuzzy)
   834 
   834 
   835     - For unstable, this means taking the first which could be rebased as a
   835     - For unstable, this means taking the first which could be rebased as a
   836       child of the working directory parent revision or one of its descendants
   836       child of the working directory parent revision or one of its descendants
   837       and rebasing it.
   837       and rebasing it.
   838 
   838 
   839     - For divergent, this means taking "." if applicable.
   839     - For divergent, this means taking "." if applicable.
   840 
   840 
   841     With --any, evolve picks any troubled changeset to solve.
   841     With --any, evolve picks any troubled changeset to repair.
   842 
   842 
   843     The working directory is updated to the newly created revision.
   843     The working directory is updated to the newly created revision.
   844     """
   844     """
   845 
   845 
   846     contopt = opts['continue']
   846     contopt = opts['continue']
  1363      ('B', 'bookmark', '', _("remove revs only reachable from given"
  1363      ('B', 'bookmark', '', _("remove revs only reachable from given"
  1364                              " bookmark"))] + metadataopts,
  1364                              " bookmark"))] + metadataopts,
  1365     _('[OPTION] [-r] REV...'))
  1365     _('[OPTION] [-r] REV...'))
  1366     # -U  --noupdate option to prevent wc update and or bookmarks update ?
  1366     # -U  --noupdate option to prevent wc update and or bookmarks update ?
  1367 def cmdprune(ui, repo, *revs, **opts):
  1367 def cmdprune(ui, repo, *revs, **opts):
  1368     """get rid of changesets by marking them obsolete
  1368     """hide changesets by marking them obsolete
  1369 
  1369 
  1370     Obsolete changesets becomes invisible to all commands.
  1370     Obsolete changesets becomes invisible to all commands.
  1371 
  1371 
  1372     Non-pruned descendant of pruned changesets becomes "unstable". Use the
  1372     Unpruned descendants of pruned changesets becomes "unstable". Use the
  1373     :hg:`evolve` to handle such situation.
  1373     :hg:`evolve` to handle such situation.
  1374 
  1374 
  1375     When the working directory parent is pruned the repository is updated to a
  1375     When the working directory parent is pruned, the repository is updated to a
  1376     non obsolete parents.
  1376     non-obsolete parent.
  1377 
  1377 
  1378     You can use the ``--succ`` option to informs mercurial that a newer version
  1378     You can use the ``--succ`` option to inform mercurial that a newer version
  1379     of the pruned changeset exists.
  1379     of the pruned changeset exists.
  1380 
  1380 
  1381     You can use the ``--biject`` option to specify a 1-1 (bijection) between
  1381     You can use the ``--biject`` option to specify a 1-1 (bijection) between
  1382     revisions to prune and successor changesets. This option may be removed in
  1382     revisions to prune and successor changesets. This option may be removed in
  1383     a future release (with the functionality absored automatically).
  1383     a future release (with the functionality absorbed automatically).
  1384 
  1384 
  1385     """
  1385     """
  1386     revs = set(scmutil.revrange(repo, list(revs) + opts.get('rev')))
  1386     revs = set(scmutil.revrange(repo, list(revs) + opts.get('rev')))
  1387     succs = opts['new'] + opts['succ']
  1387     succs = opts['new'] + opts['succ']
  1388     bookmark = opts.get('bookmark')
  1388     bookmark = opts.get('bookmark')
  1576      ] + commands.walkopts,
  1576      ] + commands.walkopts,
  1577     _('[OPTION]... [NAME]'))
  1577     _('[OPTION]... [NAME]'))
  1578 def uncommit(ui, repo, *pats, **opts):
  1578 def uncommit(ui, repo, *pats, **opts):
  1579     """move changes from parent revision to working directory
  1579     """move changes from parent revision to working directory
  1580 
  1580 
  1581     Changes to selected files in parent revision appear again as
  1581     Changes to selected files in the checked out revision appear again as
  1582     uncommitted changed in the working directory. A new revision
  1582     uncommitted changed in the working directory. A new revision
  1583     without selected changes is created, becomes the new parent and
  1583     without the selected changes is created, becomes the checked out
  1584     obsoletes the previous one.
  1584     revision, and obsoletes the previous one.
  1585 
  1585 
  1586     The --include option specifies patterns to uncommit.
  1586     The --include option specifies patterns to uncommit.
  1587     The --exclude option specifies patterns to keep in the commit.
  1587     The --exclude option specifies patterns to keep in the commit.
  1588 
  1588 
  1589     Return 0 if changed files are uncommitted.
  1589     Return 0 if changed files are uncommitted.
  1660      ('D', 'duplicate', False,
  1660      ('D', 'duplicate', False,
  1661       'do not mark the new revision as successor of the old one')],
  1661       'do not mark the new revision as successor of the old one')],
  1662     # allow to choose the seed ?
  1662     # allow to choose the seed ?
  1663     _('[-r] revs'))
  1663     _('[-r] revs'))
  1664 def touch(ui, repo, *revs, **opts):
  1664 def touch(ui, repo, *revs, **opts):
  1665     """Create successors with exact same property but hash
  1665     """Create successors that are identical to their predecessors except for the changeset ID
  1666 
  1666 
  1667     This is used to "resurrect" changesets
  1667     This is used to "resurrect" changesets
  1668     """
  1668     """
  1669     duplicate = opts['duplicate']
  1669     duplicate = opts['duplicate']
  1670     revs = list(revs)
  1670     revs = list(revs)
  1716     # allow to choose the seed ?
  1716     # allow to choose the seed ?
  1717     _('rev'))
  1717     _('rev'))
  1718 def fold(ui, repo, *revs, **opts):
  1718 def fold(ui, repo, *revs, **opts):
  1719     """Fold multiple revisions into a single one
  1719     """Fold multiple revisions into a single one
  1720 
  1720 
  1721     Revision from your current working directory to the specified one are fold
  1721     The revisions from your current working directory to the given one are folded
  1722     as a new one replacing the other
  1722     into a single successor revision.
  1723 
  1723 
  1724     you can alternatively use --rev to explicitly specify revision to be fold
  1724     you can alternatively use --rev to explicitly specify revisions to be folded,
  1725     ignoring the current working directory parent.
  1725     ignoring the current working directory parent.
  1726     """
  1726     """
  1727     revs = list(revs)
  1727     revs = list(revs)
  1728     if revs:
  1728     if revs:
  1729         if opts.get('rev', ()):
  1729         if opts.get('rev', ()):