How do I push only my first X local commits to SVN using hgsubversion?

168 Views Asked by At

I'm currently using hgsubversion on a project to enjoy the benefits of local commits while the project's official SCM is Subversion. In order to push local commits to the SVN repo, I've been using hg rebase --svn followed by a simple hg push with successful results thus far.

One small hiccup I've run into is that if I have a certain fix for something that I'd like to push, without pushing everything else, I thought I could just commit that fix and then push it. But this gives me the following message:

abort: outstanding uncommitted changes

OK, fine. So I shelve my uncommitted changes. But for some reason, I'm unable to shelve one particular change (added a new file). I figure, what the heck, I can just commit this as it won't really do any harm.

So that's what I do. But then I see that hg push can take an -r flag which, according to the help documentation, has this effect:

If -r/--rev is used, the specified revision and all its ancestors will be pushed to the remote repository.

Great! So that sounds like exactly what I want. Now say my latest two local commits are given revision numbers 94 and 95. I thought I could do hg push -r 94 and only push the first commit to SVN while the second remains a pure local commit. But for some reason this pushed both 94 and 95.

What did I do wrong?

2

There are 2 best solutions below

1
On

I am not too familiar with Hg, but this is what you can do:

hg up -r 94
hg rebase --svn
hg push --svn
0
On

Assuming you have the mq extension enabled:

hg qimport -r95:
hg qpop -a
hg push
hg qpush -a