diff --git a/hgext/narrow/narrowcommands.py b/hgext/narrow/narrowcommands.py --- a/hgext/narrow/narrowcommands.py +++ b/hgext/narrow/narrowcommands.py @@ -102,6 +102,9 @@ def clonenarrowcmd(orig, ui, repo, *args raise error.Abort(_("cannot specify other files using '%include' in" " narrowspec")) + narrowspec.validatepatterns(includes) + narrowspec.validatepatterns(excludes) + # narrowspec is passed so we should assume that user wants narrow clone opts_narrow = True opts['include'].extend(includes) diff --git a/tests/test-narrow-clone-no-ellipsis.t b/tests/test-narrow-clone-no-ellipsis.t --- a/tests/test-narrow-clone-no-ellipsis.t +++ b/tests/test-narrow-clone-no-ellipsis.t @@ -130,7 +130,7 @@ Testing the --narrowspec flag to clone > %include foo > [include] > path:dir/tests/ - > file:dir/src/f12 + > path:file:dir/src/f12 > EOF $ hg clone ssh://user@dummy/master specfile --narrowspec narrowspecs @@ -141,7 +141,7 @@ Testing the --narrowspec flag to clone $ cat > narrowspecs < [include] > path:dir/tests/ - > file:dir/src/f12 + > path:file:dir/src/f12 > EOF $ hg clone ssh://user@dummy/master specfile --narrowspec narrowspecs diff --git a/tests/test-narrow-clone.t b/tests/test-narrow-clone.t --- a/tests/test-narrow-clone.t +++ b/tests/test-narrow-clone.t @@ -239,7 +239,7 @@ Testing the --narrowspec flag to clone > %include foo > [include] > path:dir/tests/ - > dir/src/f12 + > path:file:dir/src/f12 > EOF $ hg clone ssh://user@dummy/master specfile --narrowspec narrowspecs @@ -250,7 +250,7 @@ Testing the --narrowspec flag to clone $ cat > narrowspecs < [include] > path:dir/tests/ - > file:dir/src/f12 + > path:file:dir/src/f12 > EOF $ hg clone ssh://user@dummy/master specfile --narrowspec narrowspecs @@ -278,7 +278,6 @@ Narrow spec with invalid patterns is rej $ hg clone ssh://user@dummy/master badspecfile --narrowspec narrowspecs reading narrowspec from '$TESTTMP/narrowspecs' - requesting all changes abort: invalid prefix on narrow pattern: glob:** (narrow patterns must begin with one of the following: path:, rootfilesin:) [255]