Add a parent to the original changeset in Mercurial -
i have project 24 months of source control history in mercurial repository.
i've found old tarballs of project predate source control, , think useful import repository "pre-historic" changesets.
can somehow add parent initial commit?
alternatively, possible re-play entire repository history on top of tarballs, preserving metadata (timestamps etc)?
is possible have new parent commits use timestamps of these old tarballs?
you can use convert extension build new repository tarballs imported revisions before current root revision.
first, import tarballs based on null
revision:
$ hg update null $ tar -xvzf backup-2010.tar.gz $ hg addremove $ hg commit -m 'version 2010' $ rm -r * $ tar -xvzf backup-2011.tar.gz $ hg addremove $ hg commit -m 'version 2011'
i'm using addremove above give mercurial chance detect renames between each tarball (look @ --similarity
flag fine-tune , use hg rename --after
hand mercurial further). also, remove files in working copy before importing new tarball: way next commit contain snapshot present in tarball unpack.
after you've imported tarballs above, have parallel history in repository:
[c1] --- [c2] --- [c3] ... [cn] [t1] --- [t2] --- [tm]
your old commits c1
cn
, commits tarballs t1
tm
. @ moment share no history — it's if used hg pull -f
pull unrelated repository current one.
the convert extension can used mercurial mercurial conversion rewrite parent revision of c1
tm
. use --splicemap
flag this. needs file with
<full changeset hash c1> <full changeset hash tm>
use hg log --template '{node} ' -r c1 -r tm > splicemap
generate such file. run
$ hg convert --splicemap splicemap . spliced
to generate new repository spliced
combined history. repository new, need re-clone it.
this technique similar using hg rebase
suggested kindread. difference convert wont try merge anything: rewrites parent pointer in c1
tm
. since there no merging involved, cannot fails weird merge conflicts.
Comments
Post a Comment