[PATCH] match: normpath the ignore source when expanding the 'subinclude' kind

Matt Harbison mharbison at attotech.com
Wed May 27 19:20:47 UTC 2015


# HG changeset patch
# User Matt Harbison <matt_harbison at yahoo.com>
# Date 1432747696 14400
#      Wed May 27 13:28:16 2015 -0400
# Node ID 694b522f45863a5cf7ab9e7831cba58300419503
# Parent  83e07d0983ab226fbdb7768487688d3d94e474cb
match: normpath the ignore source when expanding the 'subinclude' kind

Windows was previously getting this test failure:

  --- e:/Projects/hg/tests/test-hgignore.t
  +++ e:/Projects/hg/tests/test-hgignore.t.err
  @@ -230,6 +230,7 @@

     $ hg status
     ? dir1/file2
  +  ? dir1/subdir/subfile3
     ? dir1/subdir/subfile4
     ? dir2/file1

  @@ -241,4 +242,4 @@
     $ echo "glob:file*2" > dir1/.hgignoretwo

     $ hg status | grep file2
  -  [1]
  +  ? dir1/file2

The problem was 'source' would be in the form "F:\test-hgignore.t\.hgignore", so
when pathutil.dirname() split on '/', 'sourceroot' was empty.  Therefore, 'path'
ended up being relative instead of absolute.

diff --git a/mercurial/match.py b/mercurial/match.py
--- a/mercurial/match.py
+++ b/mercurial/match.py
@@ -50,7 +50,7 @@ def _expandsubinclude(kindpats, root):
 
     for kind, pat, source in kindpats:
         if kind == 'subinclude':
-            sourceroot = pathutil.dirname(source)
+            sourceroot = pathutil.dirname(util.normpath(source))
             pat = util.pconvert(pat)
             path = pathutil.join(sourceroot, pat)
 


More information about the Mercurial-devel mailing list