On Wed, Aug 13, 2008 at 3:30 AM, <[EMAIL PROTECTED]> wrote: > Hi, this fixes two separate issues: the latter (the source repository not > being > added to the new one's prefs/sources) had been overshadowed by issue885 > itself > (we were trying to finalize_tentative_changes without having a > tentative_pristine). The test now passes on all formats (I have moved it to > tests/). > > Hopefully, this is a correct solution, albeit not very clean in > implementation > terms, I'd say. A refactor of the involved machinery might be in place.
Let me comment on why this patch won't compile with our type witnesses. [Resolve issue885: make get --to-match work with --hashed. [EMAIL PROTECTED] move ./bugs/get_to_match.sh ./tests/get_to_match.sh hunk ./src/Darcs/Commands/Get.lhs 45 +import qualified Darcs.Repository.HashedRepo as HashedRepo( revert_tentative_changes, add_to_sources ) hunk ./src/Darcs/Commands/Get.lhs 47 -import Darcs.Repository ( PatchSet, SealedPatchSet, copy_oldrepo_patches ) +import Darcs.Repository ( PatchSet, SealedPatchSet, copy_oldrepo_patches, replacePristineFromSlurpy ) hunk ./src/Darcs/Commands/Get.lhs 68 +import Darcs.SlurpDirectory ( empty_slurpy ) hunk ./src/Darcs/Commands/Get.lhs 160 + -- FIXME all this patchSetToRepository stuff needs to be refactored hunk ./src/Darcs/Commands/Get.lhs 162 + when (format_has HashedInventory rf) $ do + HashedRepo.revert_tentative_changes + HashedRepo.add_to_sources repository fromrepo hunk ./src/Darcs/Repository/HashedRepo.lhs 32 - write_tentative_inventory, copy_repo, slurp_all_but_darcs + write_tentative_inventory, copy_repo, slurp_all_but_darcs, + add_to_sources hunk ./src/Darcs/Repository/HashedRepo.lhs 222 - appendBinFile (outr++"/"++darcsdir++"/prefs/sources") (show $ repo2cache inr `unionCaches` extractCache repo) + add_to_sources' repo inr hunk ./src/Darcs/Repository/HashedRepo.lhs 225 +add_to_sources' :: RepoPatch p => Repository p -> String -> IO () +add_to_sources' repo@(Repo outr _ _ _) inr = + appendBinFile (outr++"/"++darcsdir++"/prefs/sources") (show $ repo2cache inr `unionCaches` extractCache repo) + +add_to_sources :: RepoPatch p => Repository p -> Repository p -> IO () +add_to_sources repo (Repo inr _ _ _) = add_to_sources' repo inr + Here you use "Repository p", but all the functions in src/Darcs/Repository/HashedRepo.lhs are now required to use type witnesses. This should be checked by the test that darcs runs when you record, but isn't checked by 'make test'. Perhaps the easiest way to see the problem is: make clean && ./configure --with-type-witnesses && make witnesses A side issue you'll have when you add the type witnesses is that the single quote character can't be used on the same line as a CPP macro. In my example below, I replace the single quote with undescore (_) to work around this. Could you try amend-recording this patch and letting the record test run (darcs amend-record --edit-long-comment, then don't make any changes it will invoke the test pref)? To fix this, we'll need to add in the phantom types that correspond to the different states of the repositories: add_to_sources_ :: RepoPatch p => Repository p C(r u t) -> String -> IO () I'm not sure in add_to_sources what is the relationship between the two repositories. Specifically, how is the recorded state, unrecorded state and tentative state of the two repositories related? This should compile but it won't make the function any safer to use. So if we can find a better way to express which of r1, u1, t1, r2, u2, and t2 are equal we can improve this quite a bit. add_to_sources :: RepoPatch p => Repository p C(r1 u1 t1) -> Repository p C(r2 u2 t2) -> IO () Thanks! Jason
_______________________________________________ darcs-users mailing list [email protected] http://lists.osuosl.org/mailman/listinfo/darcs-users
