So an unhappy comment showed up on Reddit recently: <http://reddit.com/info/6j1ao/comments/c03zfnz>.
The author's plaint is that appends to a file are treated as dependent on the
previous appends, so in a file 'a\nb\nc\nd', anything that removes 'b' wipes
out c and d. (Which I find a reasonable concern, since I manage a personal
file, .ztypos, which is appended to over time, and I'm bothered that I can't go
back and selectively erase anything but the last one).
Following his example, I've whipped two shell scripts as demonstration.
The first involves prepending, and works fine:
$ mkdir foo && ( cd foo; darcs init; touch a.txt; add a.txt; echo 'baz \n quux'
>> a.txt; darcs record -a -m init; rm a.txt && touch a.txt; echo 'function foo
() {} \nbaz \n quux' >> a.txt; darcs record -a -m foo; echo 'function bar ()
{}' >> a.txt; darcs record -a -m bar; darcs unpull --all --patches=foo; darcs
changes; ); rmdir foo
Finished recording patch 'init'
Finished recording patch 'foo'
Finished recording patch 'bar'
Finished unpulling.
Mon May 12 23:03:08 EDT 2008
* bar
Mon May 12 23:03:06 EDT 2008
* init
Looks good, although no doubt a cleaner shell script exists.
The second does appends:
$ mkdir foo && ( cd foo; darcs init; touch spare.txt && add spare.txt; darcs
record -a -m init; touch a.txt; add a.txt; echo 'function foo () {}' >> a.txt;
darcs record -a -m foo; echo 'function bar () {}' >> a.txt; darcs record -a -m
bar; darcs unpull --all --patches=foo; darcs changes; ); rmdir foo
Finished recording patch 'init'
Finished recording patch 'foo'
Finished recording patch 'bar'
Finished unpulling.
Mon May 12 23:04:11 EDT 2008
* init
Oh dear. Where did bar go?
Intuitively, I don't see any intrinsic difference between the cases - shouldn't
darcs be smart enough to hold onto bar in the latter case?
(On a side note, if this is expected behaviour, do we have any tests set up for
it?)
--
gwern
JD Visa/BCC sorot bce Security Armani Wilma 97 ISCS 007
pgpH4l5n9FfI2.pgp
Description: PGP signature
_______________________________________________ darcs-users mailing list [email protected] http://lists.osuosl.org/mailman/listinfo/darcs-users
