mercurial/scmutil.py
changeset 35185 66ecde8a704d
parent 35184 bc775b8cc020
child 35206 278f1feee73a
equal deleted inserted replaced
35184:bc775b8cc020 35185:66ecde8a704d
  1284     if len(nodes) <= maxnumnodes or repo.ui.verbose:
  1284     if len(nodes) <= maxnumnodes or repo.ui.verbose:
  1285         return ' '.join(short(h) for h in nodes)
  1285         return ' '.join(short(h) for h in nodes)
  1286     first = ' '.join(short(h) for h in nodes[:maxnumnodes])
  1286     first = ' '.join(short(h) for h in nodes[:maxnumnodes])
  1287     return _("%s and %s others") % (first, len(nodes) - maxnumnodes)
  1287     return _("%s and %s others") % (first, len(nodes) - maxnumnodes)
  1288 
  1288 
       
  1289 def enforcesinglehead(repo, tr, desc):
       
  1290     """check that no named branch has multiple heads"""
       
  1291     if desc in ('strip', 'repair'):
       
  1292         # skip the logic during strip
       
  1293         return
       
  1294     visible = repo.filtered('visible')
       
  1295     # possible improvement: we could restrict the check to affected branch
       
  1296     for name, heads in visible.branchmap().iteritems():
       
  1297         if len(heads) > 1:
       
  1298             msg = _('rejecting multiple heads on branch "%s"')
       
  1299             msg %= name
       
  1300             hint = _('%d heads: %s')
       
  1301             hint %= (len(heads), nodesummaries(repo, heads))
       
  1302             raise error.Abort(msg, hint=hint)
       
  1303 
  1289 def wrapconvertsink(sink):
  1304 def wrapconvertsink(sink):
  1290     """Allow extensions to wrap the sink returned by convcmd.convertsink()
  1305     """Allow extensions to wrap the sink returned by convcmd.convertsink()
  1291     before it is used, whether or not the convert extension was formally loaded.
  1306     before it is used, whether or not the convert extension was formally loaded.
  1292     """
  1307     """
  1293     return sink
  1308     return sink