Issue 1577 reverting an addfile causes the file to be removed from the working directory

Title reverting an addfile causes the file to be removed from the working directory
Priority bug Status needs-diagnosis/design
Milestone Resolved in
Superseder Nosy List MaicoLeberle, darcs-devel, dmitry.kurochkin, kowey, markstos, mdiaz
Assigned To MaicoLeberle
Topics ThePendingPatch

Created on 2009-08-27.16:45:28 by kowey, last changed 2020-08-01.15:00:02 by bfrk.

msg8543 (view) Author: kowey Date: 2009-08-27.16:45:25
Splitting from issue540, msg2135.

This needs a regression test.

Fixing this may be tricky.  

1. The hunk/binary patches should also not be removed from working
2. You'd also want to make sure that you can unpull a file add patch.
msg16764 (view) Author: owst Date: 2013-04-10.11:48:12
I just got bitten by this.

I would argue that revert shouldn't allow reverting of newly-added files.
Perhaps it should complain, and suggest to the user that they use `darcs

    > darcs rev file_not_recorded
    Error: The file `file_not_recorded' has not been recorded in the
    repository. If you want darcs to ignore the file, but *not* delete it in
    the working directory, use `darcs remove file_not_recorded', otherwise
    simply delete the file.

Darcs revert is for using darcs to undo changes that the user has made in
working, so revert is behaving as per its remit. I think that in this case,
its unlikely that a user would ever want or expect this behaviour...
msg16765 (view) Author: owst Date: 2013-04-10.12:13:13
I've just pushed a trivial failing test for this issue.
msg22361 (view) Author: bfrk Date: 2020-08-01.14:59:59
Eek. I think the best solution is to split revert into two phases: 
first revert pending, then calculate the diff to working, then revert 
Date User Action Args
2009-08-27 16:45:28koweycreate
2013-04-10 11:48:14owstsetmessages: + msg16764
2013-04-10 12:13:14owstsetmessages: + msg16765
2014-03-22 23:52:32ghsetassignedto: mdiaz
nosy: + mdiaz
2015-03-27 22:34:36ghsetassignedto: mdiaz -> MaicoLeberle
nosy: + MaicoLeberle
2020-08-01 15:00:02bfrksetstatus: needs-reproduction -> needs-diagnosis/design
messages: + msg22361