mercurial/commands.py
branchstable
changeset 49320 3d3d7fc6035a
parent 48773 6cfa30681a1d
child 49365 79b2c98ab7b4
equal deleted inserted replaced
49315:2f326ea19fbc 49320:3d3d7fc6035a
  2085     extra = {}
  2085     extra = {}
  2086     if opts.get('close_branch') or opts.get('force_close_branch'):
  2086     if opts.get('close_branch') or opts.get('force_close_branch'):
  2087         extra[b'close'] = b'1'
  2087         extra[b'close'] = b'1'
  2088 
  2088 
  2089         if repo[b'.'].closesbranch():
  2089         if repo[b'.'].closesbranch():
  2090             raise error.InputError(
  2090             # Not ideal, but let us do an extra status early to prevent early
  2091                 _(b'current revision is already a branch closing head')
  2091             # bail out.
  2092             )
  2092             matcher = scmutil.match(repo[None], pats, opts)
  2093         elif not bheads:
  2093             s = repo.status(match=matcher)
       
  2094             if s.modified or s.added or s.removed:
       
  2095                 bheads = repo.branchheads(branch, closed=True)
       
  2096             else:
       
  2097                 msg = _(b'current revision is already a branch closing head')
       
  2098                 raise error.InputError(msg)
       
  2099 
       
  2100         if not bheads:
  2094             raise error.InputError(
  2101             raise error.InputError(
  2095                 _(b'branch "%s" has no heads to close') % branch
  2102                 _(b'branch "%s" has no heads to close') % branch
  2096             )
  2103             )
  2097         elif (
  2104         elif (
  2098             branch == repo[b'.'].branch()
  2105             branch == repo[b'.'].branch()