##// END OF EJS Templates
sparse: properly error out when absolute paths are used...
Kostia Balytskyi -
r33646:7dcb5171 default
parent child Browse files
Show More
@@ -636,10 +636,10 b' def updateconfig(repo, pats, opts, inclu'
636 newexclude = set(oldexclude)
636 newexclude = set(oldexclude)
637 newprofiles = set(oldprofiles)
637 newprofiles = set(oldprofiles)
638
638
639 if any(pat.startswith('/') for pat in pats):
639 if any(os.path.isabs(pat) for pat in pats):
640 repo.ui.warn(_('warning: paths cannot start with /, ignoring: %s\n')
640 raise error.Abort(_('paths cannot be absolute'))
641 % ([pat for pat in pats if pat.startswith('/')]))
641
642 elif include:
642 if include:
643 newinclude.update(pats)
643 newinclude.update(pats)
644 elif exclude:
644 elif exclude:
645 newexclude.update(pats)
645 newexclude.update(pats)
@@ -29,20 +29,22 b' Absolute paths outside the repo should j'
29
29
30 #if no-windows
30 #if no-windows
31 $ hg debugsparse --include /foo/bar
31 $ hg debugsparse --include /foo/bar
32 warning: paths cannot start with /, ignoring: ['/foo/bar']
32 abort: paths cannot be absolute
33 [255]
33 $ hg debugsparse --include '$TESTTMP/myrepo/hide'
34 $ hg debugsparse --include '$TESTTMP/myrepo/hide'
34
35
35 $ hg debugsparse --include '/root'
36 $ hg debugsparse --include '/root'
36 warning: paths cannot start with /, ignoring: ['/root']
37 abort: paths cannot be absolute
38 [255]
37 #else
39 #else
38 TODO: See if this can be made to fail the same way as on Unix
40 TODO: See if this can be made to fail the same way as on Unix
39 $ hg debugsparse --include /c/foo/bar
41 $ hg debugsparse --include /c/foo/bar
40 abort: c:/foo/bar not under root '$TESTTMP/myrepo' (glob)
42 abort: paths cannot be absolute
41 [255]
43 [255]
42 $ hg debugsparse --include '$TESTTMP/myrepo/hide'
44 $ hg debugsparse --include '$TESTTMP/myrepo/hide'
43
45
44 $ hg debugsparse --include '/c/root'
46 $ hg debugsparse --include '/c/root'
45 abort: c:/root not under root '$TESTTMP/myrepo' (glob)
47 abort: paths cannot be absolute
46 [255]
48 [255]
47 #endif
49 #endif
48
50
General Comments 0
You need to be logged in to leave comments. Login now