##// END OF EJS Templates
errors: raise more specifc errors from narrowcommands...
Martin von Zweigbergk -
r46733:6cc269bd default
parent child Browse files
Show More
@@ -103,7 +103,7 b' def clonenarrowcmd(orig, ui, repo, *args'
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"
@@ -252,7 +252,7 b' def _narrow('
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 )
@@ -487,7 +487,7 b' def trackedcmd(ui, repo, remotepath=None'
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'
@@ -497,7 +497,7 b' def trackedcmd(ui, repo, remotepath=None'
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')
@@ -506,7 +506,7 b' def trackedcmd(ui, repo, remotepath=None'
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 )
@@ -514,7 +514,7 b' def trackedcmd(ui, repo, remotepath=None'
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"
@@ -136,8 +136,8 b' Testing the --narrowspec flag to clone'
136
136
137 $ hg clone ssh://user@dummy/master specfile --narrowspec narrowspecs
137 $ hg clone ssh://user@dummy/master specfile --narrowspec narrowspecs
138 reading narrowspec from '$TESTTMP/narrowspecs'
138 reading narrowspec from '$TESTTMP/narrowspecs'
139 abort: cannot specify other files using '%include' in narrowspec
139 config error: cannot specify other files using '%include' in narrowspec
140 [255]
140 [30]
141
141
142 $ cat > narrowspecs <<EOF
142 $ cat > narrowspecs <<EOF
143 > [include]
143 > [include]
@@ -254,8 +254,8 b' Testing the --narrowspec flag to clone'
254
254
255 $ hg clone ssh://user@dummy/master specfile --narrowspec narrowspecs
255 $ hg clone ssh://user@dummy/master specfile --narrowspec narrowspecs
256 reading narrowspec from '$TESTTMP/narrowspecs'
256 reading narrowspec from '$TESTTMP/narrowspecs'
257 abort: cannot specify other files using '%include' in narrowspec
257 config error: cannot specify other files using '%include' in narrowspec
258 [255]
258 [30]
259
259
260 $ cat > narrowspecs <<EOF
260 $ cat > narrowspecs <<EOF
261 > [include]
261 > [include]
@@ -121,7 +121,7 b' Testing the --import-rules flag of `hg t'
121 [255]
121 [255]
122 $ hg tracked --import-rules doesnotexist
122 $ hg tracked --import-rules doesnotexist
123 abort: cannot read narrowspecs from '$TESTTMP/narrow/doesnotexist': $ENOENT$
123 abort: cannot read narrowspecs from '$TESTTMP/narrow/doesnotexist': $ENOENT$
124 [255]
124 [50]
125
125
126 $ cat > specs <<EOF
126 $ cat > specs <<EOF
127 > %include foo
127 > %include foo
@@ -133,7 +133,7 b' Testing the --import-rules flag of `hg t'
133
133
134 $ hg tracked --import-rules specs
134 $ hg tracked --import-rules specs
135 abort: including other spec files using '%include' is not supported in narrowspec
135 abort: including other spec files using '%include' is not supported in narrowspec
136 [255]
136 [10]
137
137
138 $ cat > specs <<EOF
138 $ cat > specs <<EOF
139 > [include]
139 > [include]
@@ -198,7 +198,7 b' Testing the --import-rules flag with --a'
198
198
199 $ hg tracked --import-rules specs --clear
199 $ hg tracked --import-rules specs --clear
200 abort: the --clear option is not yet supported
200 abort: the --clear option is not yet supported
201 [255]
201 [10]
202
202
203 Testing with passing a out of wdir file
203 Testing with passing a out of wdir file
204
204
@@ -224,4 +224,4 b' Testing tracked command on a non-narrow '
224 $ cd non-narrow
224 $ cd non-narrow
225 $ hg tracked --addinclude foobar
225 $ hg tracked --addinclude foobar
226 abort: the tracked command is only supported on repositories cloned with --narrow
226 abort: the tracked command is only supported on repositories cloned with --narrow
227 [255]
227 [10]
@@ -98,7 +98,7 b' Test repo with local changes'
98 * (glob)
98 * (glob)
99 abort: local changes found
99 abort: local changes found
100 (use --force-delete-local-changes to ignore)
100 (use --force-delete-local-changes to ignore)
101 [255]
101 [20]
102 Check that nothing was removed by the failed attempts
102 Check that nothing was removed by the failed attempts
103 $ hg tracked
103 $ hg tracked
104 I path:d0
104 I path:d0
@@ -422,7 +422,7 b' produces more sensible diffs)'
422 ...and 5 more, use --verbose to list all
422 ...and 5 more, use --verbose to list all
423 abort: local changes found
423 abort: local changes found
424 (use --force-delete-local-changes to ignore)
424 (use --force-delete-local-changes to ignore)
425 [255]
425 [20]
426 Now test it *with* verbose.
426 Now test it *with* verbose.
427 $ hg tracked --removeinclude d9 --verbose
427 $ hg tracked --removeinclude d9 --verbose
428 comparing with ssh://user@dummy/master
428 comparing with ssh://user@dummy/master
@@ -446,7 +446,7 b' Now test it *with* verbose.'
446 ^[0-9a-f]{12}$ (re)
446 ^[0-9a-f]{12}$ (re)
447 abort: local changes found
447 abort: local changes found
448 (use --force-delete-local-changes to ignore)
448 (use --force-delete-local-changes to ignore)
449 [255]
449 [20]
450 $ cd ..
450 $ cd ..
451
451
452 Test --auto-remove-includes
452 Test --auto-remove-includes
General Comments 0
You need to be logged in to leave comments. Login now