hgext/split.py
changeset 46843 728d89f6f9b1
parent 46758 7f6c002d7c0a
child 46923 8ee1ac083ee7
equal deleted inserted replaced
46842:ad878e3f282b 46843:728d89f6f9b1
    10 from __future__ import absolute_import
    10 from __future__ import absolute_import
    11 
    11 
    12 from mercurial.i18n import _
    12 from mercurial.i18n import _
    13 
    13 
    14 from mercurial.node import (
    14 from mercurial.node import (
    15     nullid,
    15     nullrev,
    16     short,
    16     short,
    17 )
    17 )
    18 
    18 
    19 from mercurial import (
    19 from mercurial import (
    20     bookmarks,
    20     bookmarks,
    78             revs = scmutil.revrange(repo, revlist or [b'.'])
    78             revs = scmutil.revrange(repo, revlist or [b'.'])
    79             if len(revs) > 1:
    79             if len(revs) > 1:
    80                 raise error.InputError(_(b'cannot split multiple revisions'))
    80                 raise error.InputError(_(b'cannot split multiple revisions'))
    81 
    81 
    82             rev = revs.first()
    82             rev = revs.first()
    83             ctx = repo[rev]
    83             # Handle nullrev specially here (instead of leaving for precheck()
    84             # Handle nullid specially here (instead of leaving for precheck()
       
    85             # below) so we get a nicer message and error code.
    84             # below) so we get a nicer message and error code.
    86             if rev is None or ctx.node() == nullid:
    85             if rev is None or rev == nullrev:
    87                 ui.status(_(b'nothing to split\n'))
    86                 ui.status(_(b'nothing to split\n'))
    88                 return 1
    87                 return 1
       
    88             ctx = repo[rev]
    89             if ctx.node() is None:
    89             if ctx.node() is None:
    90                 raise error.InputError(_(b'cannot split working directory'))
    90                 raise error.InputError(_(b'cannot split working directory'))
    91 
    91 
    92             if opts.get(b'rebase'):
    92             if opts.get(b'rebase'):
    93                 # Skip obsoleted descendants and their descendants so the rebase
    93                 # Skip obsoleted descendants and their descendants so the rebase