News for hackers. Stuff that matters.
Re:GCC is moving to git by shadowmint on Friday August 21, 2015 @10:06PM (#10101202)
Ive never managed to do this in mercurial. Its always a huge pain point.

Is there some extension that helps?

Re:GCC is moving to git by rbehrends on Friday August 21, 2015 @10:36PM (#10101292)
All history editing in Mercurial needs to be enabled via extensions (so that you don't shoot yourself in the foot by accident). That said, the term extension is a bit of a misnomer in this context, since most "extensions" that are being used for this are parts of core Mercurial and are simply enabled by an option (the one prominent exception I can think of is "evolve", since it's unfinished).

Here's how you do it:

  hg histedit -r .
  # change "pick" to "edit" in the edit plan.
  hg commit -i
  hg commit
  hg histedit --continue
Alternatively, and preferred, because you can then test intermediate commits:

  hg histedit -r .
  hg shelve -i
  # test that it works
  hg commit
  hg unshelve
  hg commit
  hg histedit --continue
If you don't want to affect the files in your current checkout, use hg share to create a separate checkout.

That splits the commit in two; use hg graft or hg rebase to move the commits to different branches.

> Its always a huge pain point.

Not sure why; Mercurial's commands for history editing are conceptually pretty similar to Git's. I suspect that it's mostly a difference in familiarity with the tools.

Re:GCC is moving to git by gknoy on Saturday August 22, 2015 @04:31AM (#10101926)
I'm sure part of it is familiarity, but also a difference in documentation. Git's documentation makes it EXPLICITLY clear that one thing Git is intended to be awesome at is easy branching and merging, and rebasing. When I worked on a Mercurial codebase, we pretty much didn't do feature branches (or the hg equivalent), and therefore "rewrite history" was considered not just heresy, but likely to Break Everything.

It's not that it's impossible, but that it was not clearly described how to do it right, in contrast to the Git documentation. Now that I've been using Git for nearly three years, and have used it to save my bacon, I'm sure I could find some way to do similar with Mercurial ... but only after having learned it with git.

Re:GCC is moving to git by sampo on Saturday August 22, 2015 @03:29AM (#10101817)
> Ive never managed to do this in mercurial.

`hg record` might be somewhat more cumbersome than `git add -p`. But `hg rebase` should about as nice as `git rebase`?

Re:GCC is moving to git by krupan on Saturday August 22, 2015 @09:54AM (#10102505)
hg crecord is awesome for fine grained patch splitting.
Re:GCC is moving to git by kazinator on Friday August 21, 2015 @10:22PM (#10101236)
> Its always a huge pain point.

And that is a nonstarter, once Git has opened your eyes to light-weight rewriting, done casually and frequently.