Bug 3921 - Tracked files under ignored directories indicated as deleted
Summary: Tracked files under ignored directories indicated as deleted
Status: RESOLVED FIXED
Alias: None
Product: Mercurial
Classification: Unclassified
Component: Mercurial (show other bugs)
Version: 2.6-rc
Hardware: PC Windows
: normal bug
Assignee: Bugzilla
URL:
Keywords:
: 3930 3932 3995 (view as bug list)
Depends on:
Blocks:
 
Reported: 2013-05-03 10:09 UTC by Stanimir Stamenkov
Modified: 2014-11-04 14:54 UTC (History)
9 users (show)

See Also:
Python Version: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Stanimir Stamenkov 2013-05-03 10:09 UTC
Using the "tortoisehg-stable-2.7.2174.123-x64-7b2a0a64ceca.msi" package under Windows 7:

https://bitbucket.org/tortoisehg/thg-winbuild/downloads

  $ hg --version
  Mercurial Distributed SCM (version 2.6-rc+23-f01a351db791)
  (see http://mercurial.selenic.com for more information)

  Copyright (C) 2005-2012 Matt Mackall and others
  This is free software; see the source for copying conditions. There is NO
  warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Init a repo:

  $ hg init

Create a "foo/bar" file and commit:

  $ mkdir foo
  $ echo baz> foo/bar
  $ hg add
  $ hg commit -m "Initial"

Mark everything else in the "foo" directory as ignored:

  $ echo ^foo$> .hgignore

For some reason Mercurial 2.6 indicates files explicitly added under "foo" as 'deleted':

  $ hg status
  ! foo/bar
  ? .hgignore
Comment 1 Stanimir Stamenkov 2013-05-03 10:40 UTC
At this stage (after the description) I can add ".hgignore" and commit:

  $ hg add
  adding .hgignore

  $ hg commit -m "Test"

And I'm still seeing:

  $ hg status
  ! foo\bar

I've probably first noticed this about a month ago with few existing repos of mine, trying couple of TortoiseHg nightly builds (but reverting quickly to the stable version).
Comment 2 Stanimir Stamenkov 2013-05-03 10:48 UTC
Changing the ignore pattern to:

glob:foo/**

dismisses the problem, but I would like to use regexp syntax, as I've read it is more effective for ignoring whole directory hierarchies (when issuing `hg status`, for example).  I would prefer to not having to edit existing .hgignore files just to workaround this issue, also.
Comment 3 Siddharth Agarwal 2013-05-03 11:43 UTC
Your regex is wrong -- it should be "^foo/", not "^foo$". The ignore regexes match files, not directories.
Comment 4 Matt Mackall 2013-05-03 11:46 UTC
sid0: Nonetheless, tracked files that are present should not be reported as missing.

Regression -> urgent

Bisect sez:

The first bad revision is:
changeset:   18625:2cbd27f4f3c4
user:        Durham Goode <durham@fb.com>
date:        Mon Feb 04 14:27:15 2013 -0800
summary:     dirstate: walk returns None for files that have a symlink in their path

http://www.selenic.com/hg/rev/2cbd27f4f3c4
Comment 5 Matt Mackall 2013-05-03 11:48 UTC
For the record, the ignore file for my home directory is ".*" (ignore any file I haven't specifically tracked) but doesn't encounter this issue.
Comment 6 Stanimir Stamenkov 2013-05-03 12:13 UTC
(In reply to comment #3)
I've commented further to the general mailing list:
http://www.selenic.com/pipermail/mercurial/2013-May/045508.html
Comment 7 Siddharth Agarwal 2013-05-03 12:15 UTC
Huh, we do match directories: http://selenic.com/repo/hg/file/4cdec37f0018/mercurial/dirstate.py#l667

It's been there since 2008 too. Surprising.
Comment 8 Durham Goode 2013-05-03 12:24 UTC
Investigating
Comment 9 Durham Goode 2013-05-03 14:05 UTC
The fix for this has been pushed upstream to stable.  It should be in the next release (2.6.1, or 2.7, or whatever is next).
Comment 10 Siddharth Agarwal 2013-05-08 17:50 UTC
*** Bug 3930 has been marked as a duplicate of this bug. ***
Comment 11 Siddharth Agarwal 2013-05-10 11:24 UTC
*** Bug 3932 has been marked as a duplicate of this bug. ***
Comment 12 Matt Mackall 2013-07-22 14:24 UTC
*** Bug 3995 has been marked as a duplicate of this bug. ***