[darcs-users] ask-deps transitivity behaviour opposite to what is expected
Tommy Pettersson
ptp at lysator.liu.se
Sun Apr 27 19:12:32 UTC 2008
On Fri, Apr 25, 2008 at 11:15:13AM +0100, Robin Green wrote:
> I had a darcs 2 format repo in which (as far as I can see) each patch
> should implicitly depend on (at least) the previous patch
> (incidentally, is there a way to get darcs to show what the
> dependencies are?).
Not a good way, but:
darcs push --dry-run empty_repo -p 'unique patch name'
> I then added a new file and called darcs rec with
> --ask-deps.
[...]
> It seems to me that the behaviour should be the opposite
[...]
> Can anyone explain to me what is going on here?
The --ask-deps option is broken again, and no test in the test
suite detected it. I looked into it very quickly, and it seams
like --ask-deps needs a with_selected_last_changes function.
Here's a quick diff, don't have time to make a patch right now,
and I haven't checked this is _the_ fix:
diff -rN -u old-tmp-darcs2/src/Darcs/Commands/Record.lhs new-tmp-darcs2/src/Darcs/Commands/Record.lhs
--- old-tmp-darcs2/src/Darcs/Commands/Record.lhs 2008-04-27 21:06:59.437896797 +0200
+++ new-tmp-darcs2/src/Darcs/Commands/Record.lhs 2008-04-27 21:06:59.753895637 +0200
@@ -47,7 +47,7 @@
import Darcs.Patch.Choices ( patch_choices_tps, tp_patch,
force_first, get_middle_choice, tag )
import Darcs.SelectChanges ( with_selected_changes_to_files',
- with_selected_last_changes_reversed )
+ with_selected_last_changes )
import Darcs.RepoPath ( SubPath, sp2fn, toFilePath )
import Darcs.SlurpDirectory ( Slurpy, empty_slurpy )
import Darcs.Commands ( DarcsCommand(..), nodefaults, loggers, command_stub )
@@ -394,7 +394,7 @@
[] -> error "ask_about_depends: []"
_ -> error "ask_about_depends: many"
ps' = mapFL_FL tp_patch $ get_middle_choice $ force_first ta pc
- with_selected_last_changes_reversed "depend on" (filter askdep_allowed opts) empty_slurpy ps'
+ with_selected_last_changes "depend on" (filter askdep_allowed opts) empty_slurpy ps'
$ \(_:>deps) -> return $ mapFL info deps
where headRL (x:<:_) = x
headRL NilRL = impossible
diff -rN -u old-tmp-darcs2/src/Darcs/SelectChanges.lhs new-tmp-darcs2/src/Darcs/SelectChanges.lhs
--- old-tmp-darcs2/src/Darcs/SelectChanges.lhs 2008-04-27 21:06:59.433896812 +0200
+++ new-tmp-darcs2/src/Darcs/SelectChanges.lhs 2008-04-27 21:06:59.617896136 +0200
@@ -27,6 +27,7 @@
with_selected_last_changes_to_files,
with_selected_last_changes_to_files_reversed,
with_selected_last_changes_reversed,
+ with_selected_last_changes,
view_changes,
with_selected_patch_from_repo,
) where
@@ -104,12 +105,14 @@
with_selected_last_changes_to_files :: RepoPatch p => WithPatchesToFiles (PatchInfoAnd p) a
with_selected_last_changes_to_files_reversed :: RepoPatch p => WithPatchesToFiles (PatchInfoAnd p) a
with_selected_last_changes_reversed :: RepoPatch p => WithPatches (PatchInfoAnd p) a
+with_selected_last_changes :: RepoPatch p => WithPatches (PatchInfoAnd p) a
with_selected_changes = wasc' First
with_selected_changes_to_files = wasc_' First
with_selected_last_changes_to_files = wasc_' Last
with_selected_last_changes_to_files_reversed = wasc_' LastReversed
with_selected_last_changes_reversed = wasc' LastReversed
+with_selected_last_changes = wasc' Last
data WhichChanges = Last | LastReversed | First deriving (Eq, Show)
--
Tommy Pettersson <ptp at lysator.liu.se>
More information about the darcs-users
mailing list