darcs

Issue 1505 context files with file hashes

Title context files with file hashes
Priority feature Status wont-fix
Milestone Resolved in
Superseder Nosy List WorldMaker, darcs-devel, dmitry.kurochkin, granth, kowey, premchai21, thorkilnaur
Assigned To
Topics Provisional

Created on 2009-07-24.21:43:59 by maxbattcher, last changed 2024-06-21.22:19:45 by bfrk.

Messages
msg7989 (view) Author: WorldMaker Date: 2009-07-24.21:43:57
Whereas hashed and darcs-2 repositories have means for resolving lazy 
patches via _darcs/prefs/sources and caches therein, it should be 
possible for darcs to use these existing sources to search for missing 
patches that are mentioned in context files.

It appears that darcs already attempts this (failing in get_extra), but 
the current context format is lacking a key piece of information 
necessary for patch lookup in a hashed or darcs-2 repository: the patch 
object hash. A simple comparison between a _darcs/hashed_inventory and a 
current context file shows the only key difference between the lack of 
"Hash:" lines.

It would be nice for darcs to support a --hashed-context that contains 
the hash information. It may even be smart to make this the default form 
of context, should it be backwards compatible (in which case the 
existing context may be --old-context), or for the next repository version.
msg7990 (view) Author: granth Date: 2009-07-25.00:51:32
Note that this only gets you as far as the tag that forms the base of the context. 
Beyond that, you also either need the tag to contain hashes or need the context to 
contain the hash of the parent inventory (which is present in the inventory).
msg8411 (view) Author: kowey Date: 2009-08-23.17:25:09
I can see how this would be useful for get --context from lazy branches, but I
don't yet have a good idea how beneficial this is going to be.  There is also
something attractive about contexts and inventories being just the same thing.

Two things to note.

First, this won't help for the case where the context file was generated against
a private repository (not that we should expect it to of course)

Second, this change isn't going te be backwards compatible as far as I can tell:

get_context :: B.ByteString -> ([PatchInfo],B.ByteString)
get_context ps =
    case readPatchInfo ps of
    Just (pinfo,r') ->
        case get_context r' of
        (pis,r'') -> (pinfo:pis, r'')
    Nothing -> ([],ps)

I'm a bit uncertain about to deal with the lack of backward compatibility here
and let somebody come up with a plan (need-action).

One approach might just be to support reading them in one version of darcs and
only really start introduce the hashed contexts in a later version.

It might be good to add a simple version scheme to the context files, say
replacing 'Context:' with 'Context-1.x'.  On the other hand, I'm a bit concerned
that the proliferation of version schemes (format, local format [see camp],
patch bundle [issue1099], context)

I'm also marking this Provisional because there is a chance we may have to
decide that the costs (extra complexity, compatibility headaches) are not worth
it.  Basically, this would require somebody really caring about this feature to
work out the details, submit the patch and defend it :-)
msg8415 (view) Author: kowey Date: 2009-08-23.18:00:49
Note also that this could come in handy for issue992
msg12748 (view) Author: kowey Date: 2010-10-17.12:02:22
It came up that if you want to introduce a new format, then you want to
make sure you have

- format version information
- comments mechanism
msg22342 (view) Author: bfrk Date: 2020-08-01.08:45:08
Reopening this. Adding the patch hashes as in inventories would be 
useful and make context files more secure.
msg24034 (view) Author: bfrk Date: 2024-06-21.22:19:45
I was wrong. This makes no sense because patch hashes are not invariant 
under commutation (the patch content can change when commuting patches). 
A bundle with hashes for context patches would be applicable only if the 
receiving repo has all existing patches in the same order as in the 
originating repo.
History
Date User Action Args
2009-07-24 21:43:59maxbattchercreate
2009-07-25 00:51:34granthsetstatus: unread -> unknown
nosy: + granth
messages: + msg7990
2009-08-06 14:39:10koweysetpriority: feature
nosy: kowey, granth, maxbattcher, simon, thorkilnaur, dmitry.kurochkin
2009-08-23 17:25:14koweysetstatus: unknown -> needs-reproduction
nosy: kowey, granth, maxbattcher, simon, thorkilnaur, dmitry.kurochkin
topic: + Provisional
messages: + msg8411
2009-08-23 17:25:42koweysetnosy: kowey, granth, maxbattcher, simon, thorkilnaur, dmitry.kurochkin
title: Smarter Context Files -> context files with file hashes
2009-08-23 18:00:41koweylinkissue992 superseder
2009-08-23 18:00:51koweysetnosy: kowey, granth, maxbattcher, simon, thorkilnaur, dmitry.kurochkin
messages: + msg8415
2009-08-23 18:07:54koweylinkissue555 superseder
2009-08-25 17:46:24adminsetnosy: + darcs-devel, - simon
2009-08-27 14:30:57adminsetnosy: kowey, darcs-devel, granth, maxbattcher, thorkilnaur, dmitry.kurochkin
2009-10-24 00:00:06adminsetnosy: + WorldMaker, - maxbattcher
2010-10-17 12:02:23koweysetmessages: + msg12748
2011-06-25 04:47:18premchai21setnosy: + premchai21
2017-07-31 00:25:37ghsetstatus: needs-reproduction -> given-up
2020-08-01 08:45:09bfrksetstatus: given-up -> (no value)
messages: + msg22342
2024-06-21 22:19:45bfrksetstatus: wont-fix
messages: + msg24034