[darcs-users] cheap in-repo local branches (just needs implementation)

Max Battcher me at worldmaker.net
Thu Jul 23 21:40:53 UTC 2009

Grant Husbands wrote:
> Max Battcher <me at worldmaker.net> wrote:
>> Certainly one possible solution here would be to simply carry over the Hash:
>> lines from the darcs-2 inventory format as (optional) hints for file paths
>> in context files.
> Indeed, this would work, as long as Darcs would also then check the
> local repo for parent-inventories and patches corresponding to a
> context-with-hashes that it is given. It's something that could be
> done, but is an odd and unintuitive behaviour, which is the kind of
> thing I'm arguing to avoid.

It wouldn't need to look up "parent-inventories" because the Hash: line 
is the file/patch object name. Given a Hash: in a context darcs should 
be able to quickly check _darcs/patches and then run through 
_darcs/prefs/sources as it would for any other "lazy" patch, and if it 
still doesn't find what is looking for it can fail much more gracefully 
than it does today. I don't see anything odd or unintuitive about it, 
again because this is exactly the way darcs already works in lazy repos. 
In fact, this is apparently the _existing_ behavior, because the error 
provided ("Can't find patch x in get_extra") is *precisely* the same 
that you see in any other lazy patch lookup; I'm only suggesting 
"fixing" the currently "broken" implementation to provide darcs a "last 
chance" to find the patches it is looking for.

This is also a behavior that is generally useful in semi-offline 
scenarios where a context file is used and the remote repository is 
offline, but other local/cache repos might yield necessary patches.

> My proposal in my response to Eric Lippert I do believe would be a
> stronger way forward; do you disagree with it?

I disagree with it. To be perfectly clear: I am *against* branches in 
darcs. I am happy with existing branch semantics. That said, I don't see 
a need to deny more complex tools to those that want them and thus I 
have proposed how such a tool might be built, using both existing 
mechanics and otherwise generally useful/applicable changes to darcs 
that aren't branch-mechanics specific (such as bringing context files up 
to speed with darcs 2 mechanics as suggested above or allowing darcs to 
directly use specified inventory files as context files deepening the 
inventory/context equivalence as an alternative suggestion).

You have found one small complication in my proposal (that existing 
context files wouldn't work for push/pull/...) and have counter-proposed 
something that seems to me more complicated, less elegant and eliminates 
key portions of my proposal, primarily the key that I don't think darcs 
needs to, nor should know anything at all about branching.

--Max Battcher--

More information about the darcs-users mailing list