Issue1318

Title hg commit (and others?) should warn about untracked files
Priority feature Status unread
Superseder Nosy List abuehl, djc, jglick, mpm
Assigned To Topics surprise, ui

Created on 2008-09-30.16:02:46 by jglick, last changed 2008-10-18.18:58:28 by mpm.

Messages
msg7509 (view) Author: mpm Date: 2008-10-18.18:58:28
Degrading this to feature. Untracked files are extremely common (I have dozens
in my hg directory) and this feature would interfere with many people's existing
workflows.
msg7296 (view) Author: jglick Date: 2008-10-03.15:58:26
Even making it only a warning is no good; seems to get triggered during a
routine merge. Needs to be handled inside Hg itself, I think, so that it is only
run during the actual 'commit' command.
msg7270 (view) Author: jglick Date: 2008-10-01.23:35:58
The aforementioned precommit.warnuntracked seems to break MQ: you cannot push a
patch that adds files. You can make it a warning only:

commit.warnuntracked = hg st | egrep '^[?!]'
msg7261 (view) Author: jglick Date: 2008-09-30.16:02:44
I have noticed that it is very common for people using Hg to create new files,
forget to 'hg add' them, commit, fetch, and push changes - often breaking a
build as a result. Hg should by default do better at reminding you about unadded
files (or, more rarely and usually less seriously, deleted files without 'hg
remove').

I am provisionally marking this as a bug because CVS and SVN will at least show
a '?' status during the update phase, while Hg will show no warning at all.


You can always use

[defaults]
commit = --addremove

but this has the potential to cause other accidents: there may well be a stray
core dump or whatever lying around your working dir and you would probably not
want to have your commits pick it up without asking you first. It is better for
the user to decide whether the file should be marked as added; deleted from
disk; or added to the ignore list.


[hooks]
precommit.warnuntracked = ! hg st | egrep '^[?!]'

seems to work, though (1) it is Unix-specific; (2) you have to figure this out
for yourself, which most Hg users will never get around to doing.


I would suggest that Hg by default issue a warning if there are any untracked
adds or removes when you run 'hg commit' - and perhaps also 'hg fetch', or any
other commands which normally expect an unmodified working copy. It might be
nice to have an option to make this an error rather than just a warning; it
would definitely be necessary to have an option to disable this warning, for
people who do not wish to maintain .hgignore files.
History
Date User Action Args
2008-10-18 18:58:28mpmsetpriority: bug -> feature
status: chatting -> unread
messages: + msg7509
nosy: + mpm
2008-10-03 15:58:26jglicksetmessages: + msg7296
2008-10-01 23:35:58jglicksetstatus: unread -> chatting
messages: + msg7270
2008-10-01 08:52:00djcsetnosy: + djc
2008-09-30 22:08:31abuehlsetnosy: + abuehl
2008-09-30 16:02:47jglickcreate