开发者

Mercurial: How to compact/combine specified old revisions into one?

开发者 https://www.devze.com 2023-03-31 19:01 出处:网络
I\'ve got a repository. In the middle of its life-cycle I deleted a lot of unnecessary files from it(I decided to keepthem unversioned).

I've got a repository. In the middle of its life-cycle I deleted a lot of unnecessary files from it (I decided to keep them unversioned).

hg remove
hg commit

The repo grows bigger and bigger.

And I decided to get rid of old revisions the from initial one to the revision where lot of files were removed (let's name it X). Other words I want combine these revisions (from the initial to the X) into one initial revision.

But same time to keep the history of the following revisions (X+1, etc..) as they are.

I googled for the solution, but failed.

And found nothing clever than do this:

hg init newrepo
cd oldrepo
hg archive -r X newrepo
hg export -r X+1: -o "~/patches/%R-%h.diff"
cd newrepo
hg commit -A -m 'initial release (aft开发者_运维百科er archiving)'
hg import ~/patches/*.diff

And damn it, after few successfully applied patches I receive:

Hunk #1 FAILED at xxx
Hunk #2 FAILED at xxx
2 out of 2 hunks FAILED -- saving rejects to file xxx.rej
abort: patch failed to apply

What I do wrong?

I've got 1 repo without branches (to be more exact to the revision X all branches were merged).

The second solution was * hg convert to svn * hg convert to mercurial from revisiob X+1

Failed with python backtrace (probably it was caused by our repo has about 3K files).


To filter out files from repository, you want to use hg convert (Mercurial to Mercurial) with --filemap argument (see documentation for more details). Keep in mind the affected changeset IDs (and those of all their descendants) will change.


Take a look at the Collapse extension which seems to do what you want.


You can fold changesets with MQ, or use histedit extension

0

精彩评论

暂无评论...
验证码 换一张
取 消