[darcs-users] Merge bug lost data when deleting files

szergling senatorzergling at gmail.com
Sun Dec 23 09:04:55 UTC 2007


Hi all,

I think I've discovered a way darcs will lose valuable user data. All
unrecorded changes in a file is lost if we pull from another
repository that had removed that same file. darcs still reports a
conflict, but there's now no way to "fix" this conflict, because the
file (along with all unrecorded contents) has been removed.

Am I mistaken in my mental model of what's going on? My expectation is
that no data (recorded or not) should ever be deleted when pulling
(I'm simply *gaining* patches).

To clarify, see a simple example below (with minor touch-ups for
clarity). First create repository in r1, then delete a file. In r2, we
have made unrecorded changes to the same file test.txt, and then
pull from r1. test.txt gets deleted, and all changes lost.

Thank you for your attention.

----------------------------------------

tyc20 at binks:~/temp/test$ mkdir r1
tyc20 at binks:~/temp/test$ cd r1
tyc20 at binks:~/temp/test/r1$ cat > test.txt
Original contents
tyc20 at binks:~/temp/test/r1$ cat test.txt
Original contents
tyc20 at binks:~/temp/test/r1$ darcs init
tyc20 at binks:~/temp/test/r1$ darcs add test.txt
tyc20 at binks:~/temp/test/r1$ darcs rec
Darcs needs to know what name (conventionally an email address) to use as the
patch author, e.g. 'Fred Bloggs <fred at bloggs.invalid>'.  If you provide one
now it will be stored in the file '_darcs/prefs/author' and used as a default
in the future.  To change your preferred author address, simply delete or edit
this file.

What is your email address? whatever
addfile ./test.txt
Shall I record this change? (1/?)  [ynWsfqadjkc], or ? for help: y
hunk ./test.txt 1
+Original contents
Shall I record this change? (2/?)  [ynWsfqadjkc], or ? for help: y
What is the patch name? Original.
Do you want to add a long comment? [yn]n
Finished recording patch 'Original.'



tyc20 at binks:~/temp/test/r1$ cd ..
tyc20 at binks:~/temp/test$ darcs get r1 r2
Copying patch 1 of 1... done!
Finished getting.
tyc20 at binks:~/temp/test$ cd r2
tyc20 at binks:~/temp/test/r2$ cat >> test.txt
unrecorded change here.
tyc20 at binks:~/temp/test/r2$ cat test.txt
Original contents
unrecorded change here.
tyc20 at binks:~/temp/test/r2$ darcs w
{
hunk ./test.txt 2
+unrecorded change here.
}



tyc20 at binks:~/temp/test/r2$ cd ../r1
tyc20 at binks:~/temp/test/r1$ darcs remove test.txt
tyc20 at binks:~/temp/test/r1$ darcs rec
hunk ./test.txt 1
-Original contents
Shall I record this change? (1/?)  [ynWsfqadjkc], or ? for help: y
rmfile ./test.txt
Shall I record this change? (2/?)  [ynWsfqadjkc], or ? for help: y
What is the patch name? removed file.
Do you want to add a long comment? [yn]n
Finished recording patch 'removed file.'




tyc20 at binks:~/temp/test/r1$ cd ../r2
tyc20 at binks:~/temp/test/r2$ darcs pull ../r1

Sun Dec 23 15:34:13 NZDT 2007  whatever
  * removed file.
Shall I pull this patch? (1/1)  [ynWvpxqadjk], or ? for help: y
We have conflicts in the following files:
./test.txt
Finished pulling and applying.
tyc20 at binks:~/temp/test/r2$ ls -a
.  ..  _darcs
tyc20 at binks:~/temp/test/r2$ darcs w
No changes!
tyc20 at binks:~/temp/test/r2$ darcs w -l
No changes!


More information about the darcs-users mailing list