James Bowes

Purveyor of Pre-eminent Programmes

Mercurial Head Scratcher

with 3 comments

I’m trying to generate a patch to send to a project that uses Mercurial for their scm. In the middle of some commits, I did an ‘hg pull’ and ‘hg merge’. Since I did not have ‘git rebase‘ available, I now have the merged code right in the middle of my commits. If all of my commits were adjacent, I could run ‘hg diff -r a -r b’ to get a patch containing all of the changes. They’re not, so I can’t.

In git, I could run ‘git diff master’ to compare my branch to the master branch, and get a single diff containing all the changes. I tried to find a similar command for hg. The closest I could find was ‘hg outgoing -p’; but this still contains the changes from the merged upstream code. Other examples for accomplishing this on the hg website are so convoluted as to make the average perl programmer balk.

In the end, I had to do a fresh clone, then diff the two directories.

Maybe I’m missing something, but how is it people can think that Mercurial is easier than git?


Written by jbowes

February 9, 2007 at 11:31 pm

Posted in tech, wtf

3 Responses

Subscribe to comments with RSS.

  1. The Cobbler Team is seriously considering moving to git.

    Michael DeHaan

    February 11, 2007 at 9:08 pm

  2. The Cobbler Team would be wise to do so. Has the Cobbler Executive Software Configuration Management Steering Committee produced any reports yet?

    James Bowes

    February 11, 2007 at 9:20 pm

  3. It’s actually not so different in Mercurial. You do your development on a named branch, and you import the work from the master repository on another, like so:

    hg diff -r my-branch -r master

    The one irritating gotcha is that the default branch isn’t named by default, and unless you have added a name to it, you don’t have any obvious way to select it (it’s not always ‘tip’), and have to search through the log for that revision. But the named branches are separate, and the above is equivalent to ‘git diff master’.

    Mercurial user

    August 1, 2007 at 2:09 am

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: