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