3

Is there a way I can modify the history in mercurial in order to split one commit into two separate commits?

The first of these should contain just renames/moves and the second should contain the edits. This would help with interoperability with other version control systems (e.g. perforce).

I'm hoping it's possible to automate this process with a script.

Oenotria
  • 1,692
  • 11
  • 24

1 Answers1

2
  1. It's possible
  2. With manual work
  3. Using MQ extension

Fist we convert commit to MQ-patch, second - split into 2 pathes, last - qfinish patches into permanent changesets

Lazy Badger
  • 94,711
  • 9
  • 78
  • 110
  • and if the history you want to edit has already been pushed, you might have a bigger problem. – Tom Willis Mar 02 '12 at 22:31
  • 1
    @TomWillis - anonymous branch **isn't big** problem. And yes, when you rewrite history, you must know about collateral damage. I hope, OP know dark sides of changing history – Lazy Badger Mar 03 '12 at 04:02
  • Tom - I'm aware of the issues surrounding changing the history. Perhaps some background to my problem might help. I'm using Mercurial + Perfarce plugin to interoperate with a client's perforce installation. If I make a couple of changes locally (for example, a typical refactor where the file is moved into another directory and the namespaces at the top are edited) then when I use perfarce to push these changes I lose the version history in perforce. To retain the history in perforce I must rename/move a file, commit, push to perforce, then edit the file, commit, and push to perforce again. – Oenotria Mar 10 '12 at 15:23