push pull with multiple remote location in mercurial
(I am newbie in mercurial. and version control. )
I am开发者_运维技巧 using an opensource framework clone from bitbucket(mercurial). whenever that framework is updated I run hg pull and hg update to get recent copy. now I did some modification to that framework for my own purpose, which I store at another repository on bitbucket. Now If original framework is updated, how do I merge that changes in to my own repository keeping my own change intact.
Well, here's the workflow for this.
First you clone from the third party project on bitbucket, that you want to modify, so you get the following history in your local clone:
3rd: 1---2---3
clone: 1---2---3
Then you create a new project on your bitbucket account, and push to that repo, so now you have:
3rd: 1---2---3
clone: 1---2---3
fork: 1---2---3
"fork" here simply means public clone on bitbucket.
Then you make some changes to your clone, and push to your own bb repository, now you have:
3rd: 1---2---3
clone: 1---2---3---4---5
fork: 1---2---3---4---5
Then at some point, the third party updates their repository, so now you have:
3rd: 1---2---3---4'--5'
clone: 1---2---3---4---5
fork: 1---2---3---4---5
The ' behind the revision numbers just mean that the numbers are the same, but the changeset contents are not.
At this point, you pull the 3rd party changes down into your own clone:
3rd: 1---2---3---4'--5'
clone: 1---2---3---4---5
\
\-6'--7'
fork: 1---2---3---4---5
Then you perform a merge in your clone, and you also implement a few new changes:
3rd: 1---2---3---4'--5'
clone: 1---2---3---4---5----8---9---10
\ /
\-6'--7'-/
fork: 1---2---3---4---5
and push to your bb repository:
3rd: 1---2---3---4'--5'
clone: 1---2---3---4---5----8---9---10
\ /
\-6'--7'-/
fork: 1---2---3---4---5----8---9---10
\ /
+-6'--7'-+
Again, at some point, the third party developer updates their repo:
3rd: 1---2---3---4'--5'--6'--7'
clone: 1---2---3---4---5----8---9---10
\ /
+-6'--7'-+
fork: 1---2---3---4---5----8---9---10
\ /
+-6'--7'-+
So you repeat the process, first pull:
3rd: 1---2---3---4'--5'--6'--7'
clone: 1---2---3---4---5----8---9---10
\ /
+-6'--7'-+--11'---12'
fork: 1---2---3---4---5----8---9---10
\ /
+-6'--7'-+
You merge:
3rd: 1---2---3---4'--5'--6'--7'
clone: 1---2---3---4---5----8---9---10---13
\ / /
+-6'--7'-+--11'---12'-+
fork: 1---2---3---4---5----8---9---10
\ /
\-6'--7'-/
And push:
3rd: 1---2---3---4'--5'--6'--7'
clone: 1---2---3---4---5----8---9---10---13
\ / /
+-6'--7'-+--11'---12'-+ <-- 11' and 12' corresponds to 6'/7'
fork: 1---2---3---4---5----8---9---10---13
\ / /
+-6'--7'-+--11'---12'-+
精彩评论