mercurial/scmutil.py
changeset 49972 1bd33932713d
parent 49666 4bd12c0f531e
parent 49968 566f7dd563c1
child 50029 28dfb2df4ab9
equal deleted inserted replaced
49967:5698c5eee12b 49972:1bd33932713d
   276             raise error.InputError(
   276             raise error.InputError(
   277                 _(b"%r cannot be used in a name") % pycompat.bytestr(c)
   277                 _(b"%r cannot be used in a name") % pycompat.bytestr(c)
   278             )
   278             )
   279     try:
   279     try:
   280         int(lbl)
   280         int(lbl)
       
   281         if b'_' in lbl:
       
   282             # If label contains underscores, Python might consider it an
       
   283             # integer (with "_" as visual separators), but we do not.
       
   284             # See PEP 515 - Underscores in Numeric Literals.
       
   285             raise ValueError
   281         raise error.InputError(_(b"cannot use an integer as a name"))
   286         raise error.InputError(_(b"cannot use an integer as a name"))
   282     except ValueError:
   287     except ValueError:
   283         pass
   288         pass
   284     if lbl.strip() != lbl:
   289     if lbl.strip() != lbl:
   285         raise error.InputError(
   290         raise error.InputError(