hgext/rebase.py
changeset 10636 23ab3b05bd66
parent 10628 6227c8d669d5
child 10649 e13797685ee6
equal deleted inserted replaced
10635:27027bee318e 10636:23ab3b05bd66
    26 
    26 
    27 def rebase(ui, repo, **opts):
    27 def rebase(ui, repo, **opts):
    28     """move changeset (and descendants) to a different branch
    28     """move changeset (and descendants) to a different branch
    29 
    29 
    30     Rebase uses repeated merging to graft changesets from one part of
    30     Rebase uses repeated merging to graft changesets from one part of
    31     history onto another. This can be useful for linearizing local
    31     history (the source) onto another (the destination). This can be
    32     changes relative to a master development tree.
    32     useful for linearizing local changes relative to a master
       
    33     development tree.
       
    34 
       
    35     If you don't specify a destination changeset (``-d/--dest``),
       
    36     rebase uses the tipmost head of the current named branch as the
       
    37     destination. (The destination changeset is not modified by
       
    38     rebasing, but new changesets are added as its descendants.)
       
    39 
       
    40     You can specify which changesets to rebase in two ways: as a
       
    41     \"source\" changeset or as a \"base\" changeset. Both are
       
    42     shorthand for a topologically related set of changesets (the
       
    43     \"source branch\"). If you specify source (``-s/--source``),
       
    44     rebase will rebase that changeset and all of its descendants onto
       
    45     dest. If you specify base (``-b/--base``), rebase will select
       
    46     ancestors of base back to but not including the common ancestor
       
    47     with dest. Thus, ``-b`` is less precise but more convenient than
       
    48     ``-s``: you can specify any changeset in the source branch, and
       
    49     rebase will select the whole branch. If you specify neither ``-s``
       
    50     nor ``-b``, rebase uses the parent of the working directory as the
       
    51     base.
       
    52 
       
    53     By default, rebase recreates the changesets in the source branch
       
    54     as descendants of dest and then destroys the originals. Use
       
    55     ``--keep`` to preserve the original source changesets. Some
       
    56     changesets in the source branch (e.g. merges from the destination
       
    57     branch) may be dropped if they no longer contribute any change.
       
    58 
       
    59     One result of the rules for selecting the destination changeset
       
    60     and source branch is that, unlike ``merge``, rebase will do
       
    61     nothing if you are at the latest (tipmost) head of a named branch
       
    62     with two heads. You need to explicitly specify source and/or
       
    63     destination (or ``update`` to the other head, if it's the head of
       
    64     the intended source branch).
    33 
    65 
    34     If a rebase is interrupted to manually resolve a merge, it can be
    66     If a rebase is interrupted to manually resolve a merge, it can be
    35     continued with --continue/-c or aborted with --abort/-a.
    67     continued with --continue/-c or aborted with --abort/-a.
    36     """
    68     """
    37     originalwd = target = None
    69     originalwd = target = None
   495 
   527 
   496 cmdtable = {
   528 cmdtable = {
   497 "rebase":
   529 "rebase":
   498         (rebase,
   530         (rebase,
   499         [
   531         [
   500         ('s', 'source', '', _('rebase from a given revision')),
   532         ('s', 'source', '', _('rebase from the specified changeset')),
   501         ('b', 'base', '', _('rebase from the base of a given revision')),
   533         ('b', 'base', '', _('rebase from the base of the specified changeset '
   502         ('d', 'dest', '', _('rebase onto a given revision')),
   534                             '(up to greatest common ancestor of base and dest)')),
       
   535         ('d', 'dest', '', _('rebase onto the specified changeset')),
   503         ('', 'collapse', False, _('collapse the rebased changesets')),
   536         ('', 'collapse', False, _('collapse the rebased changesets')),
   504         ('', 'keep', False, _('keep original changesets')),
   537         ('', 'keep', False, _('keep original changesets')),
   505         ('', 'keepbranches', False, _('keep original branch names')),
   538         ('', 'keepbranches', False, _('keep original branch names')),
   506         ('', 'detach', False, _('force detaching of source from its original '
   539         ('', 'detach', False, _('force detaching of source from its original '
   507                                 'branch')),
   540                                 'branch')),
   508         ('c', 'continue', False, _('continue an interrupted rebase')),
   541         ('c', 'continue', False, _('continue an interrupted rebase')),
   509         ('a', 'abort', False, _('abort an interrupted rebase'))] +
   542         ('a', 'abort', False, _('abort an interrupted rebase'))] +
   510          templateopts,
   543          templateopts,
   511         _('hg rebase [-s REV | -b REV] [-d REV] [--collapse] [--detach] '
   544         _('hg rebase [-s REV | -b REV] [-d REV] [options]\n'
   512                         '[--keep] [--keepbranches] | [-c] | [-a]')),
   545           'hg rebase {-a|-c}'))
   513 }
   546 }