recode text files in repo

Anton Shestakov engored at gmail.com
Wed Aug 28 08:24:15 UTC 2019


ср, 28 авг. 2019 г. в 02:08, Victor Sudakov <vas at 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial/attachments/20190828/72ce7d48/attachment-0002.html>


More information about the Mercurial mailing list