Pull/push deltas on a per file basis?

Tom Widmer tom.widmer at googlemail.com
Tue Mar 3 06:11:59 CST 2009


Poddey Alexander (CR/APA2) wrote:
> HI all,
> I come from subversion (on linux), now need to work on Windows and 
> decided to give mercurial a try.
>  
> I'm missing the following feature, which I think is included. Could 
> someone please point me to the correct
> documentation for this (I read the Book, the Tips and FAQ, probablely 
> overlooked it there?):
>  
>  
> my example:
> think of 2 repositories (one cloned from the other) having 2 files:
>  
>  
> rep1                            rep2
> file1           file2           file1           file2
>  
> now suppose in rep2 I edit file2 to start developement of feature2 
> (r1,changeset1),
> and file1 to include feature1 (r2,changeset2).

I think this is not the ideal way of working - you should use separate 
branches for developing separate features (you can use named branches, 
bookmarks or separate clones, or even MQ).

> i finally complete feature2 (r3,changeset3)
>  
>  
> in rep1 file2 gets edited to include feature2b (r1,changeset4).
>  
>  
> now comes the merge:
> assume feature2 in rep2 is mature, feature1 not.
> now i want to have the changes corresponding to feature2 merged to rep1.
>  
> if i pull the changeset3, I automatically get the unmature feature1 
> (because all changesets up to 3 are pulled).
>  
> how can I pull the deltas on a per file and delta basis?
> (in subversion terminology, i would merge the difference  
> (rep2,file2,r3)-(rep2,file2,r1) of file2 in rep1,file2.)

If you have separate branches/bookmarks/etc. as above, you just pull the 
head revision of the branch/bookmark/clone in question. If you have your 
undesirable situation, you have lots of options:

1. Rewrite history to get to the desirable situation:
- Clone rep2 at r1 and cherry pick in r3 (call the branch feature2)
- Clone rep2 at r0 and cherry pick in r2 (call the branch feature1)
2. Do a cherry pick directly:
- Just cherry pick r1 and r3
3. Use MQ, which allows reordering of patches
4. Other options?

Cherry picking is done using
http://www.selenic.com/mercurial/wiki/index.cgi/TransplantExtension

Tom



More information about the Mercurial mailing list