Re: Resurrecting a file?
Ben Franksen <[email protected]> Sat, 24 Mar 2018 11:21:32 +0100
| Newsgroups | gmane.comp.version-control.darcs.user |
|---|---|
| Message-ID | <[email protected]> |
Am 22.03.2018 um 11:13 schrieb Stephane Bortzmeyer: > I am wondering if there is a simply way to ressurect a file which has > been deleted some times ago. Today, I do a darcs changes (if I > remember the file name) or a darcs test (if I don't), find the last > patch where the file existed, then do a darcs clone, copy the file to > my working copy and darcs add + darcs record. > > It works but it creates a new file, losing the previous history. Is > there a better way? Yes and no. Yes, there is a better way: I would use 'darcs rollback', select the patch that removes the file, then select the change in that patch that removes the file (and probably the changes that removed its content, too). Then record the resulting changes. But no, the result of doing it like that is the same as with your method: the removal and re-addition of the file and its content destroy the "connection" between changes before and after the remove/re-add. As an alternative, you can "rewrite history" by obliterating the patch that removed the file. Whether this is approach is practical depends on the circumstances. First, obliterating the remove-patch may not work if other patches depend on it. Second, obliterate is usually frowned upon in repos that are shared with others. This is a question of established work-flow and how changes are communicated between co-workers, so it may be an okay solution in your project. As an aside: Darcs could, in principle, see that you have made a change that is the exact inverse of an earlier change and use that fact in some way when displaying changes. I am thinking about an option --squash-inverses, but it is not clear to me what the exact effect should be. Cheers Ben