# HG changeset patch # User Alexis S. L. Carvalho # Date 1202501275 7200 # Node ID a1ebd5cd7e55cf13ec7d1a54242f07572cc77c85 # Parent b41f0d6a74fcaa9ce558c0a1110e03a743ab1570 dirstate.status: avoid putting ignored files in the unknown list If list_ignored was false, we would blindly add files not in the dirstate to the unknown list. This should finish fixing issue886. diff -r b41f0d6a74fc -r a1ebd5cd7e55 mercurial/dirstate.py --- a/mercurial/dirstate.py Fri Feb 08 18:07:55 2008 -0200 +++ b/mercurial/dirstate.py Fri Feb 08 18:07:55 2008 -0200 @@ -530,6 +530,7 @@ lookup, modified, added, unknown, ignored = [], [], [], [], [] removed, deleted, clean = [], [], [] + files = files or [] _join = self._join lstat = os.lstat cmap = self._copymap @@ -547,8 +548,9 @@ if fn in dmap: type_, mode, size, time, foo = dmap[fn] else: - if list_ignored and self._ignore(fn): - iadd(fn) + if (list_ignored or fn in files) and self._dirignore(fn): + if list_ignored: + iadd(fn) else: uadd(fn) continue diff -r b41f0d6a74fc -r a1ebd5cd7e55 tests/test-revert.out --- a/tests/test-revert.out Fri Feb 08 18:07:55 2008 -0200 +++ b/tests/test-revert.out Fri Feb 08 18:07:55 2008 -0200 @@ -71,9 +71,9 @@ % reverting a rename target should revert the source ? newa %% 4 ignored files (we will add/commit everything) -? ignoreddir/file -? ignoreddir/removed I ignored +I ignoreddir/file +I ignoreddir/removed I removed %% should revert ignored* and undelete *removed reverting ignored diff -r b41f0d6a74fc -r a1ebd5cd7e55 tests/test-status --- a/tests/test-status Fri Feb 08 18:07:55 2008 -0200 +++ b/tests/test-status Fri Feb 08 18:07:55 2008 -0200 @@ -21,7 +21,7 @@ hg init repo2 cd repo2 touch modified removed deleted ignored -echo "ignored" > .hgignore +echo "^ignored$" > .hgignore hg ci -A -m 'initial checkin' -d "1000000 0" sleep 1 # make sure mtime is changed touch modified added unknown ignored @@ -37,3 +37,10 @@ hg status -C echo "hg status -A:" hg status -A +echo "^ignoreddir$" > .hgignore +mkdir ignoreddir +touch ignoreddir/file +echo "hg status ignoreddir/file:" +hg status ignoreddir/file +echo "hg status -i ignoreddir/file:" +hg status -i ignoreddir/file diff -r b41f0d6a74fc -r a1ebd5cd7e55 tests/test-status.out --- a/tests/test-status.out Fri Feb 08 18:07:55 2008 -0200 +++ b/tests/test-status.out Fri Feb 08 18:07:55 2008 -0200 @@ -99,7 +99,6 @@ A added R removed ! deleted -? ignored ? unknown hg status -C: A added @@ -118,3 +117,6 @@ I ignored C .hgignore C modified +hg status ignoreddir/file: +hg status -i ignoreddir/file: +I ignoreddir/file