101 % (filepath, encoding.strtolocal(inst.strerror)) |
101 % (filepath, encoding.strtolocal(inst.strerror)) |
102 ) |
102 ) |
103 |
103 |
104 includes, excludes, profiles = sparse.parseconfig(ui, fdata, b'narrow') |
104 includes, excludes, profiles = sparse.parseconfig(ui, fdata, b'narrow') |
105 if profiles: |
105 if profiles: |
106 raise error.Abort( |
106 raise error.ConfigError( |
107 _( |
107 _( |
108 b"cannot specify other files using '%include' in" |
108 b"cannot specify other files using '%include' in" |
109 b" narrowspec" |
109 b" narrowspec" |
110 ) |
110 ) |
111 ) |
111 ) |
250 ui.status( |
250 ui.status( |
251 _(b'...and %d more, use --verbose to list all\n') |
251 _(b'...and %d more, use --verbose to list all\n') |
252 % (len(visibletostrip) - maxnodes) |
252 % (len(visibletostrip) - maxnodes) |
253 ) |
253 ) |
254 if not force: |
254 if not force: |
255 raise error.Abort( |
255 raise error.StateError( |
256 _(b'local changes found'), |
256 _(b'local changes found'), |
257 hint=_(b'use --force-delete-local-changes to ignore'), |
257 hint=_(b'use --force-delete-local-changes to ignore'), |
258 ) |
258 ) |
259 |
259 |
260 with ui.uninterruptible(): |
260 with ui.uninterruptible(): |
485 add --addinclude, --addexclude rules in bulk. Like the other include and |
485 add --addinclude, --addexclude rules in bulk. Like the other include and |
486 exclude switches, the changes are applied immediately. |
486 exclude switches, the changes are applied immediately. |
487 """ |
487 """ |
488 opts = pycompat.byteskwargs(opts) |
488 opts = pycompat.byteskwargs(opts) |
489 if requirements.NARROW_REQUIREMENT not in repo.requirements: |
489 if requirements.NARROW_REQUIREMENT not in repo.requirements: |
490 raise error.Abort( |
490 raise error.InputError( |
491 _( |
491 _( |
492 b'the tracked command is only supported on ' |
492 b'the tracked command is only supported on ' |
493 b'repositories cloned with --narrow' |
493 b'repositories cloned with --narrow' |
494 ) |
494 ) |
495 ) |
495 ) |
496 |
496 |
497 # Before supporting, decide whether it "hg tracked --clear" should mean |
497 # Before supporting, decide whether it "hg tracked --clear" should mean |
498 # tracking no paths or all paths. |
498 # tracking no paths or all paths. |
499 if opts[b'clear']: |
499 if opts[b'clear']: |
500 raise error.Abort(_(b'the --clear option is not yet supported')) |
500 raise error.InputError(_(b'the --clear option is not yet supported')) |
501 |
501 |
502 # import rules from a file |
502 # import rules from a file |
503 newrules = opts.get(b'import_rules') |
503 newrules = opts.get(b'import_rules') |
504 if newrules: |
504 if newrules: |
505 try: |
505 try: |
506 filepath = os.path.join(encoding.getcwd(), newrules) |
506 filepath = os.path.join(encoding.getcwd(), newrules) |
507 fdata = util.readfile(filepath) |
507 fdata = util.readfile(filepath) |
508 except IOError as inst: |
508 except IOError as inst: |
509 raise error.Abort( |
509 raise error.StorageError( |
510 _(b"cannot read narrowspecs from '%s': %s") |
510 _(b"cannot read narrowspecs from '%s': %s") |
511 % (filepath, encoding.strtolocal(inst.strerror)) |
511 % (filepath, encoding.strtolocal(inst.strerror)) |
512 ) |
512 ) |
513 includepats, excludepats, profiles = sparse.parseconfig( |
513 includepats, excludepats, profiles = sparse.parseconfig( |
514 ui, fdata, b'narrow' |
514 ui, fdata, b'narrow' |
515 ) |
515 ) |
516 if profiles: |
516 if profiles: |
517 raise error.Abort( |
517 raise error.InputError( |
518 _( |
518 _( |
519 b"including other spec files using '%include' " |
519 b"including other spec files using '%include' " |
520 b"is not supported in narrowspec" |
520 b"is not supported in narrowspec" |
521 ) |
521 ) |
522 ) |
522 ) |