Issue361

Title "hg commit non-existent f1 f2" succeeds!?!
Priority urgent Status resolved
Superseder Nosy List ThomasAH, alexis, brendan, keramida, meyering, mpm, tonfa
Assigned To Topics

Created on 2006-09-06.17:03:24 by meyering, last changed 2006-12-11.17:16:37 by ThomasAH.

Files
File name Uploaded Type Edit Remove
commit.patch alexis, 2006-11-21.20:15:13 text/plain
commit2.patch alexis, 2006-11-21.22:03:34 text/plain
Messages
msg2514 (view) Author: ThomasAH Date: 2006-12-11.17:16:37
Fixed in crew and main: 8d603f8567ae
msg2403 (view) Author: alexis Date: 2006-11-21.22:03:34
New patch commit2.patch.  This one uses the bisect module to search for the
directory in the list of files.  Suggested by tonfa.
msg2397 (view) Author: alexis Date: 2006-11-21.20:15:13
how about this patch?
msg2396 (view) Author: ThomasAH Date: 2006-11-21.16:32:24
Added keramida to the nosy list
msg2395 (view) Author: ThomasAH Date: 2006-11-21.16:28:59
From Giorgos Keramidas on the list:

Changeset b4903debbe3b in mercurial/crew breaks "hg commit"
for directory entries.  This means that even if "hg stat" shows
something like:

    % hg stat .
    src/bin/ls/ls.c
    src/bin/ls/ls.1
    src/bin/ed/ed.1
    %

It's no longer possible to commit a part of the changes with:

    % hg ci src/bin/ed
msg2361 (view) Author: ThomasAH Date: 2006-11-16.07:20:37
Yes, fixed by b4903debbe3b
msg2359 (view) Author: mpm Date: 2006-11-16.05:55:38
Should be fixed in tip
msg2292 (view) Author: ThomasAH Date: 2006-10-27.15:07:30
I think bailing out with an error message is what we want, because a
warning may not be read due to an editor popping up or something.
Informing the user in the commit message is too late, because he 
might already have provided it using -m.
msg2266 (view) Author: ThomasAH Date: 2006-10-25.14:38:06
* Neal Becker <ndbecker2@gmail.com> [20061025 15:49]:
> I just committed several changes, including a few files I forgot to add.·
> This error was silently ignored.  That's bad.
>·
> hg should either:
> 1) error out
> or
> 2) just add the files and commit
msg2077 (view) Author: ThomasAH Date: 2006-10-03.12:06:40
related is the problem, that there is no error message for:
echo foo > foo
hg diff foo
msg1872 (view) Author: meyering Date: 2006-09-06.17:03:23
This command succeeds: "hg commit non-existent f1 f2":
(I.e., it exits with status 0 and checks in changes to f1 and f2),
even though the "non-existent" file doesn't exist.  Nasty.
This happens with both mercurial-0.9.1 and the very latest.

Running these commands:

    mkdir d && cd d
    hg init
    touch f1 f2
    (hg add . && hg ci -m. .) > /dev/null
    echo a > f1; echo a > f2
    hg ci -m. no-such-file f1 f2 && echo commit exits successfully

I get this output:

    no-such-file: No such file or directory
    f1
    f2
    commit exits successfully

I expected, at the very least, a nonzero exit status
to signal the failure.

Even better would be to make it so the failure stops
hg from committing the other files.
History
Date User Action Args
2006-12-11 17:16:37ThomasAHsetstatus: in-progress -> resolved
nosy: mpm, ThomasAH, tonfa, brendan, alexis, meyering, keramida
messages: + msg2514
2006-12-10 23:53:33mpmsetstatus: chatting -> in-progress
nosy: mpm, ThomasAH, tonfa, brendan, alexis, meyering, keramida
2006-11-21 22:03:34alexissetfiles: + commit2.patch
nosy: mpm, ThomasAH, tonfa, brendan, alexis, meyering, keramida
messages: + msg2403
2006-11-21 20:15:13alexissetfiles: + commit.patch
nosy: mpm, ThomasAH, tonfa, brendan, alexis, meyering, keramida
messages: + msg2397
2006-11-21 16:32:24ThomasAHsetnosy: + keramida
messages: + msg2396
2006-11-21 16:28:59ThomasAHsetstatus: resolved -> chatting
nosy: + brendan, mpm, alexis, tonfa
messages: + msg2395
2006-11-16 07:20:38ThomasAHsetstatus: testing -> resolved
messages: + msg2361
2006-11-16 05:55:39mpmsetstatus: chatting -> testing
messages: + msg2359
2006-10-27 15:07:33ThomasAHsetmessages: + msg2292
2006-10-25 14:38:14ThomasAHsetmessages: + msg2266
2006-10-03 12:06:42ThomasAHsetstatus: unread -> chatting
nosy: + ThomasAH
messages: + msg2077
2006-09-06 17:03:24meyeringcreate