Managing local changes I don't want to push?

Martin Sjögren martin.sjogren at jasper-da.com
Thu Aug 9 04:31:16 CDT 2007


tor 2007-08-09 klockan 11:03 +0200 skrev Patrick Mézard:
> Martin Sjögren a écrit :
> > We use it in a more or less centralized style, having an "official
> > repository" that everybody pull from and push to, but people set up
> > other repositories too. Now, what I want to do is have some local
> > changes (e.g. an extra target in a Makefile) that I want to be applied
> > whenever the "official" Makefile changes, but I don't want these changes
> > to tag along when I push my changes back to the official repo.
> > 
> > I tried out MQ, but either I don't understand how to make it work for
> > me, or it can't do what I want to do... 
> 
> You can do that with MQ. First, you have to setup an hg repository 
> tracking the sources you want to edit and keep it in sync with your 
> source repository. Everytime you update you main repository you have to 
> add files to hg and commit the changes as well (I assume the hg 
> repository will share your svn/whatever working copy).

Ah, you misunderstand. We're using only hg, not svn. I just thought I'd
mention what revision control systems I'm familiar with so you have an
idea of my background. Sorry for the confusion, I should've been more
clear!

> Now, you change "Makefile". To keep it somewhere (assuming it is already 
> tracked in hg), just:
> """
> hg qnew -f edit_makefile.diff
> """
> This stores your change in MQ as a patch, applied as an hg revision. 
> Before you refresh your working copy using svn/whatever:
> """
> hg qpop -a
> """
> This will unapply the patch and restore the original working copy. Then:
> 
> """
> svn update
> 
> # Sync hg again with svn working copy
> hg ci -m upstream
> 
> # Apply your patch again
> hg qpush -a
> """

Replacing "svn update + hg ci" with "hg pull -u" here would make that
work for my scenario, I guess? But how about when I want to push changes
I make? (not the ones I want to keep local, that is) Won't those changes
depend on the MQ changeset? I suppose I could do "hg qpop" before "hg
commit" and "hg push" and then do "hg qpush" again afterwards? Sounds a
bit cumbersome. :(

I tried fiddling around a bit:

$ hg qnew local-changes
$ echo "local-target:" >> Makefile
$ hg qrefresh
$ echo "new file" > other_file
$ hg add other_file
$ hg qpop
abort: local changes found, refresh first
$ hg rollback
rolling back last transaction
$ hg st
M Makefile
? other_file
$ hg diff
abort: 00changelog.i: no node 16b8de0ae5a6ccb9de733962b05c87090adf4554!

... whoops? I guess I should've qpop:ed before adding, huh? Trouble is
if I have to qpop before doing any operations, then it doesn't really
buy me much, does it?


Regards,
Martin




More information about the Mercurial mailing list