[darcs-users] currently preferred way to import history from Git
Ivan Zakharyaschev
imz at altlinux.org
Fri Jan 23 16:38:08 UTC 2015
Hi,
Fri, 23 Jan 2015 17:16 +0100, Ben Franksen <ben.franksen at online.de>:
> Ivan Zakharyaschev wrote:
>> 2015-01-22 9:53 UTC+03:00, Ganesh Sittampalam <ganesh at earth.li>:
>>
>>> 'darcs convert' is currently supported.
>>
>> So, I believe 'darcs convert --import' doesn't have the notion of Git
>> branches, does it? (At least, there are no examples of using 'darcs
>> convert --import' on the wiki at all, so I can only guess.)
>>
>> Then, I believe, I should proceed as follows if I want to import Git
>> branches AB, A, B from repo "repo", such that AB has been merged into
>> A and into B:
>>
>> mkdir repo_darcsimport
>> cd repo_darcsimport
>>
>> 1. import AB into a darcs directory ("AB"):
>>
>> mkdir AB
>> cd AB
>> (cd ../../repo; git fast-export AB) | darcs convert import
>> cd ..
>>
>> 2. import the complement of AB w.r.t. A into "A"
>>
>> darcs get AB A
>> cd A
>> (cd ../../repo; git fast-export AB..A) | darcs convert import
>> cd ..
>>
>>
>> 2. import the complement of AB w.r.t. B into "B" (analoguosly)
>>
>> Correct?
>
> Yes, that should work, assuming that AB indeed refers to the "splitting
> point" beyond which A and B differ.
Now, after I've been into exploring these things more closely, I can
tell that this is not quite possible yet with the current 'darcs
convert import'.
'darcs convert import' only creates repos from scratch. So 2. is
impossible; one can't feed extra history (in Git's notation: AB..A) to
an existing repo (A) which was initially made a clone of AB.
So I've tried another way.
I've done an experiment where I independently did an import of AB and
A into two darcs repos, hoping that the identical common source Git
commits would result in identical darcs patches, but that's not true.
cd A; darcs pull ../AB --dry-run
reports another instance of the common patch. They have different IDs.
(If someone is interested, I can post my complete shell session to
demonstrate this.)
I'm not quite sure whether this is expected and whether this could be
fixed easily. So I looked into the code, and couldn't find out why the
generated IDs should differ:
-- Darcs/Patch/Index/Types.hs:80:
makePatchID = PID . makePatchname
-- Darcs/Patch/Info.hs:282:
makePatchname :: PatchInfo -> SHA1
makePatchname pi = sha1PS sha1_me
-- and PatchInfo seems to contain only the info that must be identical
for identical Git commits:
data PatchInfo = PatchInfo { _piDate :: !B.ByteString
, _piName :: !B.ByteString
, _piAuthor :: !B.ByteString
, _piLog :: ![B.ByteString]
, isInverted :: !Bool
}
--
Perhaps someone here has ideas whether the current behavior giving
non-identical patches could and should be fixed.
Best regards,
--
Ivan
More information about the darcs-users
mailing list