ср, 28 авг. 2019 г. в 02:08, Victor Sudakov <v...@mpeks.tomsk.su>:

> For some reason, your minimalistic example does not work for me (even
> without any recoding) if there are several commits:
>
> $ hg init repo1 ; cd repo1
> $ fortune > test.txt ; hg commit -A -m test
> adding test.txt
> $ fortune > test.txt ; hg commit -A -m test
> $ fortune > test.txt ; hg commit -A -m test
> $ fortune > test.txt ; hg commit -A -m test
> $ hg export -o ../1.patch
> $ cd ..
> $ hg init repo2 ; cd repo2
> $ hg import ../1.patch
> applying ../1.patch
> unable to find 'test.txt' for patching
> (use '--prefix' to apply patch relative to the current directory)
> 1 out of 1 hunks FAILED -- saving rejects to file test.txt.rej
> abort: patch failed to apply


Okay, but what do you want 1.patch to do though? As it is in this example,
1.patch reflects what the last commit (rev 3) did and it says "find
existing test.txt, remove old fortune text, add new fortune text instead".
If test.txt is missing from repo2, then, naturally, importing 1.patch fails.

If there were test.txt in repo2, but with a different content, import would
also fail, because 1.patch needs to remove something specific and cannot
find it.

So if you want to lose the beginning of the history in repo1 by skipping
the export-import of the first 3 commits (revs 0, 1, 2) and starting from
rev 3, then you'll need to use hg archive -r 2 to populate repo2 directory
with all the files needed for patches based on rev 3 (and descendants of
rev 3) and then commit all these files into repo2.
_______________________________________________
Mercurial mailing list
Mercurial@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial

Reply via email to