Mercurial > hg
changeset 23534:83bbedc16b3f
addremove: warn when addremove fails to operate on a named path
It looks like a bad path is the only mode of failure for addremove. This
warning is probably useful for the standalone command, but more important for
'commit -A'. That command doesn't currently abort if the addremove fails, but
it will be made to do so prior to adding subrepo support, since not all subrepos
will support addremove. We could just abort here, but it looks like addremove
has always silently ignored bad paths, except for the exit code.
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Wed, 26 Nov 2014 14:27:36 -0500 |
parents | 891aaa7c0c70 |
children | 72c23fa4f52f |
files | mercurial/scmutil.py tests/test-addremove.t |
diffstat | 2 files changed, 17 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/scmutil.py Sun Nov 09 19:57:02 2014 -0500 +++ b/mercurial/scmutil.py Wed Nov 26 14:27:36 2014 -0500 @@ -721,9 +721,15 @@ similarity = float(opts.get('similarity') or 0) rejected = [] - m.bad = lambda x, y: rejected.append(x) + origbad = m.bad + def badfn(f, msg): + if f in m.files(): + origbad(f, msg) + rejected.append(f) + m.bad = badfn added, unknown, deleted, removed, forgotten = _interestingfiles(repo, m) + m.bad = origbad unknownset = set(unknown + forgotten) toprint = unknownset.copy()
--- a/tests/test-addremove.t Sun Nov 09 19:57:02 2014 -0500 +++ b/tests/test-addremove.t Wed Nov 26 14:27:36 2014 -0500 @@ -22,6 +22,16 @@ $ hg forget foo $ hg -v addremove adding foo + $ hg forget foo +#if windows + $ hg -v addremove nonexistant + nonexistant: The system cannot find the file specified + [1] +#else + $ hg -v addremove nonexistant + nonexistant: No such file or directory + [1] +#endif $ cd .. $ hg init subdir