# HG changeset patch # User padraigob@netbeans.org # Date 1205941087 0 # Node ID 42c8c96aa97214824290ae58b51f06ee84b92302 # Parent c5b14758ee6992a380f571d22c0e51cd7da16b66 130135: Ignore a file if its parent matches a pattern diff -r c5b14758ee69 -r 42c8c96aa972 mercurial/src/org/netbeans/modules/mercurial/util/HgUtils.java --- a/mercurial/src/org/netbeans/modules/mercurial/util/HgUtils.java Wed Mar 19 11:29:41 2008 +0300 +++ b/mercurial/src/org/netbeans/modules/mercurial/util/HgUtils.java Wed Mar 19 15:38:07 2008 +0000 @@ -306,7 +306,6 @@ public class HgUtils { public static boolean isIgnored(File file, boolean checkSharability){ if (file == null) return false; String path = file.getPath(); - String name = file.getName(); File topFile = Mercurial.getInstance().getTopmostManagedParent(file); // We assume that the toplevel directory should not be ignored. @@ -332,8 +331,14 @@ public class HgUtils { return true; } } + // If a parent of the file matches a pattern ignore the file + File parentFile = file.getParentFile(); + while (!parentFile.equals(topFile)) { + if (isIgnored(parentFile, false)) return true; + parentFile = parentFile.getParentFile(); + } - if (FILENAME_HGIGNORE.equals(name)) return false; + if (FILENAME_HGIGNORE.equals(file.getName())) return false; if (checkSharability) { int sharability = SharabilityQuery.getSharability(file); if (sharability == SharabilityQuery.NOT_SHARABLE) return true;